/[(.*?)]/ won't match anything having to do with square brackets. It is a character set (the [] metacharacters) consisting of the ( ) . * ? characters.
Update: Something like m{ \[ ([^]]*) \] }xms might be useful:
>perl -wMstrict -le "my $s = 'foo [bar baz] quux [%^&*] boff [] biff'; my @bracketed = $s =~ m{ \[ ([^]]*) \] }xmsg; print qq{'$_'} for @bracketed; @bracketed = $s =~ m{ \[ [^]]* \] }xmsg; print qq{'$_'} for @bracketed; " 'bar baz' '%^&*' '' '[bar baz]' '[%^&*]' '[]'
In reply to Re^2: Parsing and Obtaining Values from output
by AnomalousMonk
in thread Parsing and Obtaining Values from output
by Perllace
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |