in reply to random search in file

hi,

you can make hash from reading the file line by line.
my $hash; foreach my $line (<FH>) { $line =~ /^(\w+)\s(.+)/; }
so you get first field(data1, data2,..) in $1 and all the data in $2 variable.
so u can split the $2 so u will get array.
my @arr = split(" ", $2); now use this to create the hash
$hash{$1} = [@arr];
now to get the last value you can use pop
pop @{$hash{"data4"}};