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 <>;
In reply to Re^4: printing array using map
by GrandFather
in thread printing array using map
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |