Some old code that i was testing with was accidently left in, the subroutine
is:
sub prepareandread_inputs {
foreach my $input (@inputs) {
if ($input->{gzip}) {
$input->{handler} = gzopen($input->{full_path}, 'r')
or die 'io;'.$input->{full_path} unless $input->{handle
r};
$input->{last_line}=$input->{handler} if
$input->{readnow};
$input->{last_line}->gzreadline($input->{last_line})
if $input->{readnow};
} else {
$input->{handler} = new FileHandle
$input->{full_path} or die 'io;'.$input->{full_path} unless $input->{hand
ler};
$input->{last_line} = $input->{handler}->getline if
$input->{readnow};
}
chomp($input->{last_line}) if $input->{readnow};
($input->{last_date}, $input->{last_hour},
$input->{last_min}, $input->{last_sec}) = &get_date_time($input->{last_li
ne}) if $input->{readnow};
$input->{readnow}=0 if $input->{readnow};
}
}
Sorry, and thanks,
Matt
-----Original Message-----
From: Matthew Walkup [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 29, 2001 10:39 AM
To: [EMAIL PROTECTED]
Subject: Globals in Subroutines
my (@inputs, @last, $output);
sub prepareandread_inputs {
my $temporary;
push(@inputs, $temporary) while ($temporary = shift);
foreach my $input (@inputs) {
if ($input->{gzip}) {
$input->{handler} = gzopen($input->{full_path}, 'r')
or die 'io;'.$input->{full_path} unless $input->{handle
r};
$input->{last_line}=$input->{handler} if
$input->{readnow};
$input->{last_line}->gzreadline($input->{last_line})
if $input->{readnow};
} else {
$input->{handler} = new FileHandle
$input->{full_path} or die 'io;'.$input->{full_path} unless $input->{hand
ler};
$input->{last_line} = $input->{handler}->getline if
$input->{readnow};
}
chomp($input->{last_line}) if $input->{readnow};
($input->{last_date}, $input->{last_hour},
$input->{last_min}, $input->{last_sec}) = &get_date_time($input->{last_li
ne}) if $input->{readnow};
$input->{readnow}=0 if $input->{readnow};
}
}
Im attempting to use globals in the above subroutine simply by using the
following line to call it:
prepareandread_inputs();
however anything done inside the subroutine does not apply to the rest of
the program, what am I doing wrong?
Thanks in advance for any assistance,
Matt
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]