Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Loops and variable usage

by Eliya (Vicar)
on Mar 23, 2012 at 18:34 UTC ( [id://961281]=note: print w/replies, xml ) Need Help??


in reply to Loops and variable usage

I don't see any loop, but I do see a couple of things which most likely don't do what you intended.  Maybe retry with this:

sub ddd { my $a = $_[0]; my $b = $_[1]; my $c = $_[2]; # could also be written as: # my ($a, $b, $c) = @_; if ($a == 1) { $a = 'p'; } elsif ($a == 2) { $a = 'pp'; } if ($b == 3) { $b = 'w'} print " < $a > < $b > < $c >"; }

Replies are listed 'Best First'.
Re^2: Loops and variable usage
by Anonymous Monk on Mar 23, 2012 at 18:41 UTC
    Sorry, the loop is on upper level I tried to make it simpler. I have tried different combinations with my and none worked. for example $a is always 'p' even if the $_[0] was '2'. the loop is feeding the subroutine the proper values.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-24 12:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found