Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Shortcut operator for $a->{'b'}=$b if $b;

by chester (Hermit)
on Sep 20, 2005 at 16:43 UTC ( #493512=note: print w/replies, xml ) Need Help??


in reply to Re: Shortcut operator for $a->{'b'}=$b if $b;
in thread Shortcut operator for $a->{'b'}=$b if $b;

What's the for doing, there? Doesn't this work?

$b and $a->{'b'} = $b

edit: Doesn't solve the problem fully.

Replies are listed 'Best First'.
Re^3: Shortcut operator for $a->{'b'}=$b if $b;
by merlyn (Sage) on Sep 20, 2005 at 16:48 UTC
      Ah, I see. My mistake.
Re^3: Shortcut operator for $a->{'b'}=$b if $b;
by ikegami (Pope) on Sep 20, 2005 at 16:48 UTC

    foreach loops sets $_ to refer to the current value in the list which is being iterated. In this case, the list consists solely of $b.

    Your expression is equivalent, but it's not an acceptable answer since the question was about removing the need for using $b twice.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://493512]
help
Chatterbox?
[Corion]: Meh, first round of escalations for me not wanting to fix in production what a project has mismanaged. Now another project, which eats up all the resources until end of this year wants to take that task and put it on my list of things as well.
[Corion]: So now there will be the fun of me explaining to the project that $other_project had low priority because $project has high priority. If $project picks up the task from $other_project, they also will need to reprioritize my tasks to get that done...
[Corion]: ... of course at the cost of something else on my list of tasks for $project, as there only is a finite amount of days until $deadline.

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2017-08-17 12:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Who is your favorite scientist and why?



























    Results (287 votes). Check out past polls.

    Notices?