in reply to printing array using map
Is there a reason you insist on using 'map'? An explicit 'for' loop would be more legible. Not that I dislike 'map', but once past a certain degree of complexity, you really should break it out.
#!/usr/bin/perl -wl use strict; print for map { y/[]//d; join " ", reverse split } <DATA>; __DATA__ w1 w2 w3 [t4 w4] w5
Update: My assumption is the opposite of netwallah's, since 'map' would print an arrayref as 'ARRAY(0xDEADBEEF)' rather than '[foo bar]'.
-- Human history becomes more and more a race between education and catastrophe. -- HG Wells
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: printing array using map
by Anonymous Monk on Apr 27, 2008 at 18:26 UTC | |
by johngg (Canon) on Apr 27, 2008 at 20:53 UTC | |
by GrandFather (Saint) on Apr 27, 2008 at 21:54 UTC | |
by johngg (Canon) on Apr 27, 2008 at 22:01 UTC | |
by FunkyMonk (Bishop) on Apr 27, 2008 at 22:22 UTC | |
by johngg (Canon) on Apr 28, 2008 at 10:04 UTC | |
by FunkyMonk (Bishop) on Apr 27, 2008 at 22:19 UTC |