in reply to File slurping into $text and then accessing a specific line?
Yes, it is possible. But why are you slurping into $text?
Slurping is recommended only if the presence of multiple lines of data in a single scalar somehow makes your task easier. Usually this is not the case.
Far from showing us why you needed to slurp, you are asking how to access a particular line.
use warnings; use strict; my $PARTICULAR_LINE; # regex print '-' x 80; while (<DATA>) { s/========KEYWORD.+\n//; print; if ( /$PARTICULAR_LINE/ ) { access($_) } } print '-' x 80; __DATA__
This does the same printing job as the code you posted, and it accesses the particular line.
|
|---|