in reply to Re: Using my and library....
in thread Using my and library....
I hope you can enlighten me :)# hash.lib # in the library sub gethash { my $hash_ref; open(FILE, "data.txt") || die "Can't open data - $!\n"; # dick:98 # robert:76 # mary:68 chomp(my @lines = <FILE>); close(FILE); foreach (@lines) { my ($name,$score) = split /:/, $_; $hash_ref->{ 'name' } = $name; $hash_ref->{ 'score' } = $score; } return( $hash_ref ); } # script1.pl # some code in another script eval { ($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); require 5.001; require "hash.lib"; }; my $key_value = gethash(); # I want to be able to print the values here....
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using my and library....
by tadman (Prior) on Aug 17, 2002 at 13:15 UTC | |
|
Re: Re: Re: Using my and library....
by Anonymous Monk on Aug 17, 2002 at 13:01 UTC | |
|
Re: Re: Re: Using my and library....
by smalhotra (Scribe) on Aug 17, 2002 at 14:04 UTC | |
by kiat (Vicar) on Aug 18, 2002 at 13:03 UTC |