use strict; my @array = qw/A B C [ D ] E F/; my @outarray; my $outid = 0; my $incrm = 1; for my $ch ( @array ) { $outarray[$outid] .= $ch; $incrm = ( $ch eq '[' ) ? 0 : ( $ch eq ']' ) ? 1 : $incrm; $outid += $incrm; } print "@outarray\n";
In reply to Re^3: Test if variable is equal to a bracket?
by graff
in thread Test if variable is equal to a bracket?
by mdunnbass
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |