A few points about your code.
In your pattern \d{1} is exactly the same as saying \d, IOW a quantifier of one is implicit and needn't be stated.
Be aware that a full stop is a regular expression metacharacter matching any character (with caveats, see perlre) so did you mean to match a decimal point in this pattern /returns \d{1} \(in \d{1}.\d{6} secs/? Consider this code
$ perl -le ' > print > m{\d{1}.\d{6}} > ? qq{$_: Matched} > : qq{$_: No match} > for > q{in 1.234567 secs}, > q{in 12345678 secs}, > q{in 3A987654 secs};' in 1.234567 secs: Matched in 12345678 secs: Matched in 3A987654 secs: Matched $
You will need to escape the dot if you want a decimal point
$ perl -le ' > print > m{\d{1}\.\d{6}} > ? qq{$_: Matched} > : qq{$_: No match} > for > q{in 1.234567 secs}, > q{in 12345678 secs}, > q{in 3A987654 secs};' in 1.234567 secs: Matched in 12345678 secs: No match in 3A987654 secs: No match $
Now only a literal full-stop is matched.
Consider using the three-argument form of open with lexical filehandles.
Avoid using the variable names $a and $b as they are special and should be reserved for use in sort routines.
I hope these points are helpful.
Cheers,
JohnGG
In reply to Re: Print the matched pattern
by johngg
in thread Print the matched pattern
by kingjamesid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |