Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: s/this/$that/ Gives Variable Name, Not Contents of Variable

by VinsWorldcom (Prior)
on Oct 07, 2013 at 15:31 UTC ( [id://1057269]=note: print w/replies, xml ) Need Help??


in reply to s/this/$that/ Gives Variable Name, Not Contents of Variable

No idea - it works for me. Windows 7 x64 with Strawberry 5.16.1:

VinsWorldcom@C:\Users\VinsWorldcom\tmp> perl -v This is perl 5, version 16, subversion 1 (v5.16.1) built for MSWin32-x +64-multi-thread [...] VinsWorldcom@C:\Users\VinsWorldcom\tmp> cat test.pl my $foo = "stuff"; open FD, "file.txt"; @data = <FD>; close FD; foreach (@data) { s/XXYY/$foo/; print; } VinsWorldcom@C:\Users\VinsWorldcom\tmp> cat file.txt XXYY VinsWorldcom@C:\Users\VinsWorldcom\tmp> test.pl stuff

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1057269]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-23 06:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found