"L F" "LF" "L.F" "L. F" "HTML" "XML" "X.H.T.M.L" "X. H. T. M. L" "X H T M L" #### #!/usr/bin/perl use strict; use warnings; $|=1; while (my $line = ) { next if $line =~ /^\s*$/; #skip blank lines $line =~ s/\s*$//; #delete line endings print "INPUT LINE: \'$line\'\n"; $line =~ s/\s+|\,|\.//g; #remove spaces, commas, periods my @acron = $line =~ m/([A-Z]{2,})/g; #get sequence of 2 or #more uppercase chars print "Acronym $_\n" for @acron; } =Prints INPUT LINE: 'L F and LF and L.F. and L. F. and not L, F.' Acronym LF Acronym LF Acronym LF Acronym LF Acronym LF INPUT LINE: 'some HTML some XML.' Acronym HTML Acronym XML INPUT LINE: 'or X.H.T.M.L. or X. H. T. M. L. or even X H T M L' Acronym XHTML Acronym XHTML Acronym XHTML INPUT LINE: 'but not U and I,' INPUT LINE: 'or You and I.' INPUT LINE: '...' =cut __DATA__ L F and LF and L.F. and L. F. and not L, F. some HTML some XML. or X.H.T.M.L. or X. H. T. M. L. or even X H T M L but not U and I, or You and I. ...