$baz = "mythingie"; ($foo, $bar) = $baz =~ s/(my)(.*)//; #### use strict; $baz = 'mythingie'; if($baz =~ s/(my)(.*)//){ #s/// returns '' (which is false) if it doesn't match. #No, I don't know why it doesn't return 0. $foo = $1; $bar = $2; } else { warn 'I thought this would always match, but I must be wrong'; }