in reply to Re^3: printing array using map
in thread printing array using map

Why chomp when you put the newline back anyway? If the OP doesn't need to explicitly check for balanced brackets then the regex simplifies too:

print map {s/\[|\]//g; $_} <>;

Or if your taste runs to for loops and you don't mind the occasional comma operator:

s/\[|\]//g, print for <>;

Perl is environmentally friendly - it saves trees

Replies are listed 'Best First'.
Re^5: printing array using map
by johngg (Canon) on Apr 27, 2008 at 22:01 UTC
    Yep, no need to chomp, force of habit I guess :-(

    Cheers,

    JohnGG