Pablo Fischer wrote: > > Hi again Hello,
> Ok, I have a file that each part of this is separated by pipes (|), so I load By "each part" I think you mean each line? > the file in an array and then split it, the file has 8 parts: > > Part 1: a Number > Part 2: a Big String (Maybe Im gonna use an array in this part) > Part 3: a Number > Part 4: a String > Part 5: a BIG text (the same as PArt 2, load in an array) > Part 6: another BIG text > Part 7: a String > Part 8: a number > > So I have the Perl script like this: > > #Abrimos el archivo > open(ARCHIVO, "F737.JOP"); You should _ALWAYS_ verify that the file opened correctly. open ARCHIVO, 'F737.JOP' or die "Cannot open F737.JOP: $!"; > #Guardamos el archivo > my @file = <ARCHIVO>; @file now contains each line from the file in a separate element. > #Cerramos el archivo > close(ARCHIVO); > #Load the Data > my($num, $fulanos, $tiempo, $subject, $bodyhtml, $bodytxt, $attach, > $fechaenvio) = split(/\|/,@file); ^^^^^ Using @file in a scalar context returns the number of elements in @file. > print "$num | $fulanos | $tiempo | $subject | $attach | $fechaenvio\n"; > > But When I print it doest print what it NEEDS to print, and example of the > first pipes of F737.JOP: > > 1|Env7371.txt(6)|1|1 > > And it prints: > > 136 | | | | | ^^^ That means that @file contained 136 elements which means that 'F737.JOP' has 136 lines in it. > I tried to change the split, to split(/|/,@file);, but the same, no good > results :-( > > What could I bee doing bad? You probably want to read and split each line. open ARCHIVO, 'F737.JOP' or die "Cannot open F737.JOP: $!"; while ( <ARCHIVO> ) { my ( $num, $fulanos, $tiempo, $subject, $bodyhtml, $bodytxt, $attach, $fechaenvio ) = split /\|/; print join( ' | ', $num, $fulanos, $tiempo, $subject, $attach, $fechaenvio ), "\n"; } close ARCHIVO; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]