sage-
> > From: James Ferree [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, August 08, 2001 4:42 PM
> > To: James Ferree; [EMAIL PROTECTED]
> > Subject: Re: Loading file into hash
> >
> >
> >
> > --- James Ferree <[EMAIL PROTECTED]>
> -Original Message-
> From: James Ferree [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 08, 2001 4:42 PM
> To: James Ferree; [EMAIL PROTECTED]
> Subject: Re: Loading file into hash
>
>
>
> --- James Ferree <[EMAIL PROTECTED]> wrote:
> >
--- James Ferree <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am looking for a way to load a file containing the
> following example data into a hash
>
> #From TO
> Jim James
> Art Arthur
> JohnArthur
>
> Then when $a=Jim I would like to convert it to
> $a=James.
>
> Can this be done?
Quite easily:
open(IN,$file) || die "could not open $file: $!\n";
while ()
{
s:#.*$::; # weed out comments
next unless /\S/; # make sure there's something to input
($from,$to)=split /\s+/; # split the line by the whitespace
$hash{$from}=
On Wed, Aug 08, 2001 at 08:56:59AM -0700, James Ferree wrote:
: Hi,
:
: I am looking for a way to load a file containing the
: following example data into a hash
:
: #From TO
: Jim James
: Art Arthur
: JohnArthur
:
: Then when $a=Jim I would like to convert it to
: $a=James.
:
: