[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] s(a)(AAA) -- wow




Wow. I knew you could change / to any character for matching and substituting...

   s///  can be written as  s###  or  sxxx

But I've never seen parens used before!

test code
--------------------
% cat j.pl
#!/usr/bin/perl

my $j = "blah away";
$j =~ s(a)(AAA)g;
print "$j\n";

% perl j.pl
blAAAh AAAwAAAy
--------------------

Actual code I ran into in Pod::Tree::PerlPod:

    my $perl_dir = $perl_pod->{perl_dir};
    my $html_dir = $perl_pod->{html_dir};
       $dest     =~ s(^$perl_dir)($html_dir);

Wow.....

hese work too:

s[a][AAA]g
s{a}{AAA}g

What arcane crap *can't* you do in Perl?

Laugh,

j