my @foo; { local $/ = 'certain string'; open my $file, '<', '/path/to/afile' or die $!; @foo = (<$file>)[0..2]; }
Now @foo contains everything up to and including the third occurance.
After Compline,
Zaxo
In reply to Re: Extracting up to a certain string
by Zaxo
in thread Extracting up to a certain string
by Jaspersan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |