RE: Loading file into hash

2001-08-08 Thread James Ferree
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]>

RE: Loading file into hash

2001-08-08 Thread Bob Showalter
> -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: > >

Re: Loading file into hash

2001-08-08 Thread James Ferree
--- 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?

RE: Loading file into hash

2001-08-08 Thread Mooney Christophe-CMOONEY1
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}=

Re: Loading file into hash

2001-08-08 Thread Casey West
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. : :