Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re^4: if(my) scope

by oha (Friar)
on Oct 12, 2009 at 14:50 UTC ( #800729=note: print w/replies, xml ) Need Help??

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

that's another thing:
if(my $x = expr) { ... } # my always executed my $x if expr; # my is conditional if(expr) { my $x } # as above
what i was saying is that if i can my on a arg of a function, maybe i can do the same in the "argument" of a if


Replies are listed 'Best First'.
Re^5: if(my) scope
by ikegami (Pope) on Oct 12, 2009 at 17:01 UTC
    "as above" is unclear. I think you meant "my is conditional", but it's really "my always executed" (in the scope in which it resides).
    c() or my $x; # XXX Conditionally executed c() and my $x; # XXX Conditionally executed my $x if c(); # XXX Conditionally executed (same as previous) sub foo { my $x } # OK Always executed if (c()) { my $x } # OK Always executed die; my $x; # OK Always executed

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://800729]
[Discipulus]: everything is .* in regexes: it has drawbacks (can be nul, is greedy..) so /hey.*,0$/ can be a solution
[Discipulus]: but pleas take a look here (page 97) and to standard documentation
[Discipulus]: perlre and perlreref

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2018-03-20 07:59 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (248 votes). Check out past polls.