in reply to Re: How to input variable value from a file?
in thread How to input variable value from a file?

Hi Wind, Thanks.. it worked (except for a minor fix). Thanks again! :)
#open my $fh, $serverfile or die "Can't open $serverfile: $!"; open my $fh, "serverfile" or die "Can't open $serverfile: $!"; my @services = map {chomp; [split]} <$fh>; close $fh;

Replies are listed 'Best First'.
Re^3: How to input variable value from a file?
by wind (Priest) on Jun 09, 2011 at 20:25 UTC

    You just need to initialize the variable.

    Don't forget use strict; and use warnings at the top of every script.

    use strict; use warnings; my $serverfile = 'foo.bar';