in reply to Reseting pos()

Someone please tell me why this script fails returning "ERROR: NOCOL C/T ENG".

"C/T ENG" doesn't exist in $titles after where "OPTIONS" was found. Why are you using the g modifier and pos? All you need is

foreach my $col ( @cols ) { if ( $titles !~ /\Q$col/ ) say "ERROR: NOCOL $col"; } }

Replies are listed 'Best First'.
Re^2: Reseting pos()
by EvanCarroll (Chaplain) on May 02, 2008 at 14:53 UTC
    Because I need the pos() and the pos() doesn't appear to work if you don't have /g


    Evan Carroll
    I hack for the ladies.
    www.EvanCarroll.com
      Why do you need pos? I think you really want @- and maybe @+