in reply to Reaped: Re^2: case sensitive addition
in thread case sensitive addition
#!/usr/bin/perl use warnings; use strict; print 'Enter a File name: '; chomp (my $file = <STDIN>); print 'Enter a search pattern: '; chomp (my $pattern = <STDIN>); open (my $fh, '<', $file) or die "Unable to open '$file' for reading: +$!"; my $found = 0; while (<$fh>) { if (/\Q$pattern\E/i) { print; $found++; } } print "\nTotal lines matched: $found\n";
Cheers - L~R
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: case sensitive addition
by Nathan_84 (Acolyte) on May 14, 2010 at 23:49 UTC | |
|
Re^4: case sensitive addition
by Nathan_84 (Acolyte) on May 15, 2010 at 01:56 UTC | |
by ww (Archbishop) on May 15, 2010 at 13:49 UTC |