catfish1116 has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to get a match on a line that begins with 'barney'. Below is the code. I have ran this and I always get the message, 'barney not found'. When I take the ^ and m away and just have /barney/, then it works.
$_ = 'This is a wilma line barney is on this line but this line ends with fred and a final dino line' ; if (/^barney/m) { print "Found barney \n"; } else { print "Barney not found \n"; } ~
Thanks in advance catfish
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: matching problem
by jwkrahn (Abbot) on Dec 26, 2018 at 22:48 UTC | |
Re: matching problem
by syphilis (Archbishop) on Dec 26, 2018 at 22:54 UTC | |
Re: matching problem
by beech (Parson) on Dec 26, 2018 at 22:49 UTC | |
Re: matching problem
by Athanasius (Archbishop) on Dec 27, 2018 at 03:54 UTC | |
by Anonymous Monk on Dec 27, 2018 at 10:04 UTC |