On Thursday, April 18, 2002, at 11:21 , Felix Geerinckx wrote: [..] > Personally, however, I prefer an explicit 'return' statement, as in > > return map { ($_ => 1) }, @array; > > (The () are optional). [..]
Ok, I can go there... so my test code shows me [jeeves:~/tmp/perl/misc] drieux% perl perl MapMe.pl SUB: /tmp /usr/bin /bin Got me a :cascade ~/tmp: Got me a :cascade ~/usr/bin: Got me a :cascade ~/bin: [jeeves:~/tmp/perl/misc] drieux% #!/usr/bin/perl -w use strict; my @dir = qw! /tmp /usr/bin /bin !; sub doMe { my @themDir = @_; print "SUB: @themDir \n"; return map {[ 'cascade', '~'.$_]} @themDir; } # end doMe my @retList = doMe(@dir); print "Got me a :@{$_}: \n" foreach(@retList); The HARSH is that the 'map' is returning 'arrays references' in this case...... hence the fun of @{$_} otherwise it's the old Got me a :ARRAY(0x12798): Got me a :ARRAY(0x127c8): Got me a :ARRAY(0x127f8): so if one wanted that to return the 'list' of things rather than the list of references to the thing it should have been return map {( 'cascade', '~'.$_)} @themDir; using the () vice [ ].... ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]