On Tuesday 23 March 2004 13:13, mike wrote: > > I am trying to get rid of a blank line at the start of a text file, > and I dont understand why this does not work > > open(UPD1,"tem");# this file exists
You should *ALWAYS* verify that the file opened successfully. open UPD1, 'tem' or die "Cannot open tem: $!"; > my @update1=<UPD1>; > foreach $update1(@update1){ Is there a good reason to read the entire file into an array? > $update1=~s/^(\n)//; That removes a newline if it is the first character in the line. The parentheses are not required. > $update1=~chomp; That is the same as: $update1 =~ /0/; if the previous line removed the newline and: $update1 =~ /1/; if it did not remove the newline. This is probably what you want to do instead: foreach my $update1 ( @update1 ) { chomp $update1; next unless $update1 =~ /\S/; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>