RosettaCodeData/Task/Balanced-brackets/Perl/balanced-brackets-3.pl

6 lines
116 B
Perl
Raw Permalink Normal View History

2015-02-20 00:35:01 -05:00
use Regexp::Common 'balanced';
my $re = qr/^$RE{balanced}{-parens=>'[]'}$/;
2014-04-02 16:56:35 +00:00
sub balanced {
2015-02-20 00:35:01 -05:00
return shift =~ $re;
2014-04-02 16:56:35 +00:00
}