in reply to Reading a file and working only on certain lines
Try this:
#!/usr/bin/env perl + use strict; use warnings; my $char = shift || die $!; my $file = $0; open( my $fh, "<", $file ) || die $!; while (<$fh>) { print if /^o/; # your part goes here } close $fh; __END__
Please see also strict, warnings, my, shift, die, while, open, print, if, close, perlretut as well as TMTOWTDI.
For the rest: RTFM ;-)
Update: Immediate feedback is a good thing. But please note: I really didn't want to be harsh or impolite. And i marked the dubious hint as a joke.
Regards, Karl
«The Crux of the Biscuit is the Apostrophe»
|
|---|