Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: How to use __DATA__ efficiently, help!

by Anonymous Monk
on Feb 09, 2011 at 19:56 UTC ( [id://887266]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to use __DATA__ efficiently, help!
in thread How to use __DATA__ efficiently, help!

I am getting weird numbers in the middle of the html code; 1 and 11, using:
while (<DATA>) { $_.=s/<--date\/\/>/$date/; $_.=s/<--loc\/\/>/$location/; $data .= $_ }
Any ideas why?

Replies are listed 'Best First'.
Re^4: How to use __DATA__ efficiently, help!
by Anonyrnous Monk (Hermit) on Feb 09, 2011 at 20:02 UTC
    $_.=s/<--date\/\/>/$date/;

    You probably meant

    $_ =~ s/<--date\/\/>/$date/; ...

    or just (as $_ is the default anyway)

    s/<--date\/\/>/$date/; ...

    s/// returns the number of substitutions made, so as you have it, you're appending that number to $_.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2026-02-08 08:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.