in reply to Re: referencing list
in thread referencing list
There must be a more elegant way of doing ths eg by using: my @x = ($shape, $colour. $tag) ; rather than having a separate list for each attribute.my @shape = ("round", "square", "polygon"); my @colour = ("red", "salmon", "purple" ); my @tag ; for my $j ( 0..2 ) { if ( ($shape[$j] eq "round") && ($colour[$j] eq "red") ) {$tag[$j]=1;} else {$tag[$j]=0;} print "$shape[$j] $colour[$j] $tag[$j]\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: referencing list
by tobyink (Canon) on Jun 06, 2012 at 06:29 UTC |