in reply to split and tie::file
After this line:
my $archivo = 'test-pdf.tex';
$archivo contains the exact literal text, "test-pdf.tex". That means the literal text held in $archivo doesn't have "\begin{document}" anywhere in it, so there's nothing for split to work with.
If you printed the contents of $archivo, or the contents of @coment, you would see that the primary failure is right there. Also, it's unnecessary to chomp the lines. The default behavior for Tie::File is to auto-chomp, and then replace the record separator (usually '\n') behind the scenes as the line is written back to the file. If you want to completely remove '\n', you'll need to set Tie::File to override the default behavior. You probably don't want or need to do this, but if you do, it's handled by the autochomp => 0 option upon initiating the tie.
As for opening the key file, you actually need to use open, as in, "open my $fh, '<', $archivo or die $!;, and then read first line of the file as my $line = <$fh>; (for example).
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: split and tie::file
by pablgonz (Initiate) on May 30, 2011 at 11:20 UTC | |
by pablgonz (Initiate) on May 31, 2011 at 04:03 UTC |