On Thu, 13 Dec 2001, Robinson, Josh wrote:

> Hi there, just having a problem accessing a singular hash value. Check the
> prog:
> 
> open(FILE, "I:\\itscript\\temp\\BBGPriceImport\.imp") or die"Input file
> didn't open";

Even under DOS/Windows, you can use forward-slashes rather than
backslashes as directory separators.  Also, there is no need to escape .
in a string.  So you can rewrite the above as the more readable

  open(FILE, "I:/itscript/temp/BBGPriceImport.imp") or die "Input file
  didn't open";

> my @list;
> my @list2;
> my $i;
> my %hashy = %_;

Why are you copying the entire main symbol table??

> my $temp ='';
> 
> @list = <FILE>;
> 
> foreach $i (@list){
>       ($list2[0], $list2[1], $list[2]) = split(/\s+/, $i, 3);

More easily written as

  @list2[0..2] = split /\s+/, $i, 3;

or even just

  @list2 = split /\s+/, $i, 3;

if there isn't anything already in later elements of @list2 you care about
keeping.

>       $hashy{$list2[0]} = $list2[1];
> }
> 
> print("Tell me the CUSIP you want to retrieve the ticker for\n");
> $temp = <STDIN>;
> chomp($temp);
> $temp = "\n" . $hashy{$temp}[1];
> print($temp);
> sleep 10;
> 
> 
> for whatever reason, I can see the value of $hashy{$temp}[1] in the
> komodo debugger but I can't get it to report on the command line. The
> assignment to $temp is a shot at a quick fix. Anybody have an idea as to
> the dumb move I'm making here? 

Not sure why that might be, but cleaning up your code as suggested above
(and especially not loading the entire symbol table into your hash) might
help clarify things.

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "The line dividing good and evil cuts through the heart
   |   of every human being." - Alexander Solzhenitsyn

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl

Reply via email to