Hi kingdom, If I understood your question correctly then workout this,
use strict;
use warnings;
use Switch;
open (FILE, shift)||die $!;
while(<FILE>){
switch ($.) {
case 1 { (m/^12345.67890$/) ? (print "Line $. \"$&\" Matched\n")
+: (print "Line $. Not Matched\n"); }
case 2 { (m/^13456.12345$/) ? (print "Line $. \"$&\" Matched\n")
+: (print "Line $. Not Matched\n"); }
case [3..5]{ (m/^\d+$/) ? (print "Line $. \"$&\" Matched\n") : (p
+rint "Line $. Not Matched\n"); }
}
}
close(FILE);
Input is: (test.txt)
12345.67890
13456.12345
12A345.67890
13E456.12345
12B345.67890
Output is:
Line 1 "12345.67890" Matched
Line 2 "13456.12345" Matched
Line 3 Not Matched
Line 4 Not Matched
Line 5 Not Matched
Regards,
Velusamy R.
eval"print uc\"\\c$_\""for split'','j)@,/6%@0%2,`e@3!-9v2)/@|6%,53!-9@2~j';