#!/usr/bin/perl use strict; use warnings; my $sentence = "abxcd zwe rrv"; my $wantedLetters = "zxv"; my $flag=0; my @a = split '',$wantedLetters; for( my $i=0; $i<$#a+1; $i++ ) { if($sentence !~ /$a[$i]/) {$flag=1;last;} } if ($flag==1){print "not all wanted letters found"} else {print "all letters are found"}