sub getvalue {
my $line = shift; # get the argument
my $start = index($line, ':');
return substr($line, $start+2, length($line));
}
####
print getvalue($PasswordLine);
print getvalue($MinattLine);
print getvalue($MaxattLine);
print getvalue($ExpLine);
print getvalue($GoldLine);
####
while ( my $line = ) {
...
}
close FILE;
####
chomp $line;
my ($key, $value) = split(/\s*:\s*/, $line);
####
$data{$key} = $value;
####
print $data{password};
print $data{minatt};
print $data{maxatt};
print $data{exp};
print $data{gold};
####
#!/usr/local/bin/perl -w
use strict;
open FILE, "user/test" or die "Error: $!\n";
my %data = ();
while ( my $line = ) {
chomp $line;
my ($key, $value) = split(/\s*:\s*/, $line);
$data{$key} = $value;
}
close FILE;
print $data{password};
print $data{minatt};
print $data{maxatt};
print $data{exp};
print $data{gold};