2011/3/28 jj mahoney <itshardtoget...@hotmail.com>:
>
> Hi, How do I name this variable correctly, @{bet$random_bet_position);
> With regards to the script below, @selected_bet is suppose to select either 
> @bet1, @bet2 or @bet3 depending on the chosen number held by 
> $random_bet_position, so how do I do this? Thanks
>
> @bet1 = (0,0,0,0);
> @bet2 = (0,0,0,1);
> @bet3 = (0,0,1,0);
>
> $random_bet_position = int(rand(3) + 1);
>
> @selected_bet = @{bet$random_bet_position);


What you want is an Array of Arrays.  Other replies have given you
syntax that covers it, but you would be well served by reading the
documentation that covers them: perldoc perldsc or the web version
http://perldoc.perl.org/perldsc.html.  You will also want to become
familiar with references and how they work: perldoc perlref and
http://perldoc.perl.org/perlref.html.  If you find that document too
formidable, you may want to start with: perldoc perlreftut or
http://perldoc.perl.org/perlreftut.html.


-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to