my $matched = do { my $i = length $_; $_ eq substr "foobar",0,$i; }; #### my $matched = ($_ eq substr "foobar",0,length);