The Discovery

Ah, Perl...

Sometimes regexes look like heiroglyphics. I had a good laugh when I read somewhere that Perl regular expressions look like modem-generated line noise. However, I'll always remember my first encounter. I was given a program to debug and I nearly went crazy trying to figure out why a boolean comparison of two unequal strings resulted in true when using the "==" operator.

This wasn't the actual code, but you can tell why this would make a Perl neophyte psychotic.

> cat str-comp.pl
use strict;
use warnings;

my $x = 'hello';
my $y = 'goodbye';

if($x == $y){
  print "They're equal\n";
}
else {
  print "They're NOT equal\n";
}

> perl str-comp.pl
Argument "goodbye" isn't numeric in numeric eq (==) at str-comp.pl line 7.
Argument "hello" isn't numeric in numeric eq (==) at str-comp.pl line 7.
They're equal

Ay yi yi

BTW: If you're a Perl n00b, this website should be helpful: Perl 101.