$varalias =~ s/=.*//; # Delete everything(.*) from the equals on $vartarget =~ s/"$//; # Delete the quote at the end($) #### # If able to delete the stuff(.*) between the beginning # of the line(^) and the word 'alias' and one-or-more spaces(\s+) # found after that ... if (s/^.*?alias\s+//) { # Extract the 1st, 5th and 7th "words" my ($varalias, $varsource, $vartarget) = (split(' '))[1,5,7]; # Then whatever... } #### print OUT < $varsource $vartarget END_HTML #### if ($something) { some_code(); if ($something_else) { some_other_code(); } }