From: "Taylor, Andrew \(ASPIRE\)" <andrew.tayl...@hmrcaspire.com>
> I have a script that is (at one point) reading through a file.  The file
> is processed line by line and each line split into an array like so: 
> 
> while (<$TESTFILE>)
> {
>   my $cur_line=$_;
>   chomp ($cur_line);

while (defined(my $cur_line = <$TESTFILE>)) {
  chomp($cur_line);

>   my $default_type;
>   if( $split_line[0] eq "DEFAULT_INPUT" )
>   {
>     $default_type = "INPUT";
>   } 
>   if ( $split_line[0] eq "DEFAULT_OUTPUT" )
>   {
>     $default_type = "OUTPUT";
>   }

my $default_type = do {
  if ($split_line[0] eq "DEFAULT_INPUT" ) {
    "INPUT"
  } elsif ($split_line[0] eq "DEFAULT_OUTPUT" ) {
    "OUTPUT"
  }
};

Jenda
===== je...@krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to