in reply to Perl is returning... odd results... from regular expressions. Things matching when they shouldn't, and stuff like that.

There's no comma leading the data, but it matches anyway... how?

What makes you think it matched? In the code you presented, m/^,/ is evaluated, then its value is discarded, then $i is evaluated, and its value is used to determine whether to enter the if or not. Since $i is true, the if is entered.

Where you trying to do the following?

my $j=0; if ($i =~ m/^,/){ print $j++ . ": " . $i . "\n"; }
  • Comment on Re: Perl is returning... odd results... from regular expressions. Things matching when they shouldn't, and stuff like that.
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: Perl is returning... odd results... from regular expressions. Things matching when they shouldn't, and stuff like that.
by Groxx (Novice) on Jan 11, 2007 at 08:01 UTC
    I thought I saw somewhere that m//,STRING worked... Guess not, my mistake ^^;

    Thanks! That's part of the problem, at least. Very much appreciated!

      m// is the same as $_ =~ m//
        That one I knew, though now I'm fighting between sleep and finding what command it was that made me think that what I did would work...

        Ah well. Sleep is winning. Thanks for the speedy replies though, this site has thus far FAR exceeded my expectations!