You can shorten this down using $_.
while(my $line = <LL>) { next if $line =~ /^\s*$/; if ($line =~ /\)\.\s*$/) { # attempt to match on .) at end of line $myTitle = <>; print LOGFILE $myTitle; } } can be written as: while(<LL>) { if ($_ =~ /\)\.\s*$/) { # attempt to match on .) at end of line my $mytitle = <LL>; print LOGFILE $mytitle; } } It doesn't seem like much in this example, but the $_ variable can be very useful and save you a lot of time. -----Original Message----- From: Booher Timothy B 1stLt AFRL/MNAC [mailto:[EMAIL PROTECTED]] Sent: Friday, February 01, 2002 11:35 AM To: [EMAIL PROTECTED] Subject: Wade through a file and grab titles I have a bunch of files in the form below and I want to go through the list and extract only the file name. The only way I can consistently see this is to take the next line after the ")." ahmad73 ______ exist: 0 K. Ahmad and I. J. Smalley, Powder Technol. 8, 69 (1973). Observation of particle segregation in vibrated granular systems . keywords: segregation vibration ahn91 ______ exist: 0 H. Ahn, C. E. Brennen, and R. H. Sabersky, J. Appl. Mech. 58, 792 (1991). Observation of particle segregation in vibrated granular systems . ahn92 ______ exist: 0 H. Ahn, C. E. Brennen, and R. H. Sabersky, J. Appl. Mech. 59, 109 (1992). Analysis of the fully developed chute flow of granular materials . I tried the following: # NOT WORKING open(LL,$ARGV[0]) || die "can't open $ARGV for reading: $!"; # input file open(LOGFILE,">$ARGV[1]") || die "can't open output file $ARGV[1]"; #output file while(my $line = <LL>) { next if $line =~ /^\s*$/; if ($line =~ /\)\.\s*$/) { # attempt to match on .) at end of line $myTitle = <>; print LOGFILE $myTitle; } } This is returning all files as if the regex were continually true . . . any body with a sharp eye -------------------------------------------------------------------------------- This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]