in reply to count number of lines with +
Gets input from user (i.e, from STDIN)
my @array = grep { /^\+\s+/, print $_ } <> ; print scalar @array;
If you pass the file name as command line argument also this script works, <> will check for @ARGV array for input file.So if you call this script as perl pattenmatch.pl filename.txtwhatever is in @ARGV is used instead.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: count number of lines with +
by ladnjay (Initiate) on Jul 23, 2014 at 06:30 UTC | |
by vinoth.ree (Monsignor) on Jul 23, 2014 at 07:18 UTC | |
by ladnjay (Initiate) on Jul 23, 2014 at 08:27 UTC | |
by oiskuu (Hermit) on Jul 23, 2014 at 09:41 UTC | |
by ladnjay (Initiate) on Jul 24, 2014 at 03:54 UTC |