I am searching for a string in Perl and storing it in another scalar variable. I want to print this scalar variable. The code below doesn\'t seem to work. I am not sure what is
m//
returns the captured matches in list context:
#!/usr/bin/perl
use strict;
use warnings;
my $pattern = qr/^\s{10}([0-9]{2})\s[A-Z]/;
while ( my $line = ) {
if ( my ($n) = $line =~ $pattern ) {
print "$n\n";
}
}
__DATA__
13 E 0.496 -> Q 0.724
18 S 0.507 -> R 0.513
19 N 0.485 -> S 0.681
21 N 0.557 -> K 0.482