CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions: s/// : Why doesn't this work?: Edit Log



Zippy1970
Novice

Mar 4, 2013, 5:00 AM


Views: 11484
s/// : Why doesn't this work?


Code
my $str = '$1$'; 
my $key = '$1$ Hello World!';
$key =~ s/$str//;
print "$key\n";

Output:

$1$ Hello World!


As you can see, it's not removing '$1$'. This behavior is new to me. What am I missing here?


(This post was edited by Zippy1970 on Mar 4, 2013, 5:00 AM)


Edit Log:
Post edited by Zippy1970 (Novice) on Mar 4, 2013, 5:00 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives