#!/usr/bin/perl use strict; use warnings; my $line; # don't put a my declaration in a loop conditional print "Enter data at prompt, blank line to finish data entry\n"; while ( (print "> "), $line = , $line !~ /^\s*$/) { $line =~ s/^\s*//; # delete leading spaces $line =~ s/\s*$//; # delete trailing spaces # no chomp is needed because both # carriage return and line feed are # white space characters (\s) in Perl # regex lingo print "Data processed:$line\n"; } print "LOOP EXITED DUE TO BLANK LINE\n"; #### #!/usr/bin/perl use strict; use warnings; my $line; # don't put a my declaration in a loop conditional print "Enter data at prompt or type: quit to stop data entry\n"; while ( (print "> "), $line = , $line !~ /^\s*Q(uit)$/i) { $line =~ s/^\s*//; # delete leading spaces $line =~ s/\s*$//; # delete trailing spaces # no chomp is needed because both # carriage return and line feed are # white space characters (\s) in Perl # regex lingo print "Data processed:$line\n"; } print "LOOP EXITED DUE TO QUIT \n";