while () { if (/^frz\s+=\s+(\w+);/) {$bar=$1} } #### "abc123def"=~/([a-z]+(\d+)(.*))/; print "first: $1\nsecond: $2\nthird: $3\n";