>me said:
>> How would I go about creating a second array using map
>> or grep without changing the original? Can I do that at all?
>@foo = @bar;
Sorry, I should have been clearer on this question.
What I was looking for is a way to take an element from @foo - change it in
some way, and place it in @bar without changing the original element of
@foo.... but do it in one line of code:
my @foo = ("line 1", "line 2", "line 3", "line 4", "line 5");
for (@foo){
my $temp = $_;
$temp=~s/line/element/;
push @bar, $temp;
}
to end up with @foo (as above) and @bar:
"element 1", "element 2 " and so on.
I was thinking it might be possible to do this in one line using map......?
Tom Watson