Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^4: get current script as text

by pvaldes (Chaplain)
on Apr 24, 2012 at 15:46 UTC ( #966880=note: print w/ replies, xml ) Need Help??


in reply to Re^3: get current script as text
in thread get current script as text

mmh, I see... The problem is very silly. I forgot to add a last line to print the variable.

my $codeAsText = do{ local( @ARGV, $/ ) = $0; <>; }; print $codeAsText;

Perhaps you meant:

open (my $foo, $0); print <$foo>; close $foo;

Yes, This solves the problem also, thanks!


Comment on Re^4: get current script as text
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2014-08-30 11:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (293 votes), past polls