Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: if(my) scope

by ikegami (Pope)
on Apr 16, 2009 at 15:53 UTC ( #758019=note: print w/replies, xml ) Need Help??


in reply to Re^2: if(my) scope
in thread if(my) scope

You changed
if (my $var) { ... }
to
if (...) { my $var; ... }
use strict; use warnings; use Devel::Peek; my $ref; if ((my $fred = 42), 1) { $ref = \$fred; Dump($$ref); } Dump($$ref);
SV = IV(0x816a5cc) at 0x814f684 REFCNT = 2 FLAGS = (PADBUSY,PADMY,IOK,pIOK) IV = 42 SV = IV(0x816a5cc) at 0x814f684 REFCNT = 2 FLAGS = (PADBUSY,PADMY,IOK,pIOK) IV = 42

A scope is created for if's curlies, but only a compile-time scope is created for the condition expression.

Btw, note the proper usage of Dump.

Replies are listed 'Best First'.
Re^4: if(my) scope
by cdarke (Prior) on Apr 16, 2009 at 16:01 UTC
    Doh!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://758019]
help
Chatterbox?
[marioroy]: LA, yeah. than there's no reason why it cannot work inside qx. But chatting is hard in PM. I cannot see the code now.
[shmem]: Lady_Aleena: sometimes a quick glance isn't enough.
[Lady_Aleena]: What?! Can't stat ~/Music: No such file or directory? The ~/ doesn't expand?
[Lady_Aleena]: And the env variable $HOME doesn't work either. !@#$
[shmem]: no, that's a shell feature. Use $ENV{HOME}
[marioroy]: my $ans = qx{ find \$HOME -name "*.pl" -exec ls -l {} \\; };

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2017-04-23 21:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (432 votes). Check out past polls.