# $_ is the default buffer and pattern space while(){ /^(\[\w+\])(.+)/; my $prefix = $1; my $values = $2; print "prefix:$prefix values:$values\n"; }