in reply to referencing list

use Data::Alias; my @x = (1, 2, undef) ; alias my ($a, $b, $c) = @x ; $c = $a + $b ; print "@x\n" ;
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Replies are listed 'Best First'.
Re^2: referencing list
by pmilne (Novice) on Jun 06, 2012 at 03:17 UTC
    As Data::Alias is not standard in the version of PERL I am using, this may not be what I am looking for. Perhaps I could give another example:
    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"; }
    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.
      Data::Alias is a module. To use it you need to install it. That's the point of modules: they are modular; you only install the ones you need. Not sure what you're trying to say with your second example; it appears to have little in common with the first.
      perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'