if( $line =~ /^ ( \w+ ) # word \s+ ( .+? ) \s+ ( \w+ ) $/ ) { my( $command, $something, $lastword ) = ( $1, $2 , $3 ); }