IB2017 has asked for the wisdom of the Perl Monks concerning the following question:
Hello monks,
dumb question, but I am trying to change the following grep:
my @tags = split /\t/, $line; my @Definition=("NN", "NNS"); next unless (grep {$_ eq $tags[ 1 ]} @Definition);
in order that it matches only at the beginning of the string. I thought that the following would do it, but I was wrong...:
next unless grep($_ =~ /^$tags[1]/, @Definition);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: grep beginning of string (updated)
by haukex (Archbishop) on Dec 12, 2018 at 17:46 UTC | |
|
Re: grep beginning of string
by thanos1983 (Parson) on Dec 13, 2018 at 09:10 UTC |