$str = "the boy walked the dog"; $str =~ s/walked/fed/ =~ s/boy/girl/ =~ s/dog/Audrey II/; # error #### $str =~ 1 #### if ($str =~ s/boy/girl/) { # do this }