my $vol_to_parse = qr{ /what/ever }xms; my $line = get_a_line_somehow(); if ($line =~ m{ ($vol_to_parse .*) }xms) { print "$1 \n"; }