in reply to Re^8: Perl vs C
in thread Perl vs C
#!usr/bin/perl -w use warnings; sub modify_list { my $listRef = shift; @$listRef = grep{!/^b/}@$listRef; #note there is no "return" value here #the list has been modified!!!! } my @list = ("a1", "b23", "c45", "d1", "b43", "b65"); print join (" ",@list),"\n"; #prints: a1 b23 c45 d1 b43 b65 modify_list(\@list); print join (" ",@list),"\n"; #prints a1 c45 d1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^10: Perl vs C
by ikegami (Patriarch) on Mar 16, 2009 at 15:34 UTC | |
by Marshall (Canon) on Mar 16, 2009 at 15:58 UTC | |
by ikegami (Patriarch) on Mar 16, 2009 at 16:17 UTC | |
by Marshall (Canon) on Mar 16, 2009 at 17:02 UTC | |
by ikegami (Patriarch) on Mar 16, 2009 at 17:21 UTC | |
| |
|
Re^10: Perl vs C
by chromatic (Archbishop) on Mar 16, 2009 at 18:13 UTC |