#!/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
In reply to Re^3: case sensitive addition
by Limbic~Region
in thread case sensitive addition
by Nathan_84
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |