epistrophy has asked for the wisdom of the Perl Monks concerning the following question:
Unfortunately, no number was put in the new list. I thought that I had to initialize a value for $i to $l, but when I do that the part of map that says which numbers should be added seems to be ignored. Here's my question(s): Do I have to initialize a value, and if so, where? Is map the best solution to my problem. Should I use a hash, and if so, why and how? best, Ruben van de Vijver@newsent = map {if ($i == 0){$i + 1} elsif ($i % 10 == 0){$i += 10 +}; $i," ",$_} @testsent; @newfillers = map {$j % 2 == 0 && $j % 10 != 0;$j," ", $_} @fillers +; @newfoils = map {unless ($k == 1){$k % 2 != 0 && $k % 5 != 0}; $k, +" ",$_} @foils; @newwords = map {$l % 5 == 0; $l," ",$_} @words;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: merging files using map
by keszler (Priest) on Jul 01, 2004 at 11:09 UTC | |
by keszler (Priest) on Jul 01, 2004 at 11:25 UTC | |
by epistrophy (Initiate) on Jul 01, 2004 at 11:55 UTC | |
by keszler (Priest) on Jul 01, 2004 at 13:29 UTC |