It helps in that it seems to confirm that I was going
about it the right way.  It doesn't in that I can't
get it to work for me.  I'll go read some more
documentation.

By the way, what does AW: mean?


--- "B. Fongo" <[EMAIL PROTECTED]> wrote:
> 
> 
> That should work provided you're returning only on
> list.
> It is much better to use reference when passing or
> retrieving more than
> one value.
> 
> For instance: Retrieve the values from a sub as
> refereces.
> 
> ($xRef, $yRef, $zRef) = example();
> 
> # 
> my @x = @$x;
> my @y =  @$y;
> my $z = $$z;
> 
> 
> sub example {
>       do this and that; 
>       # Return 3 values as refereces.
>       return (\ @x, [EMAIL PROTECTED], \$z );
>       return \(@x, @y, $z);# Simpler
> }
> 
> 
> HTH
> Babs 
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Stuart White [mailto:[EMAIL PROTECTED] 
> Gesendet: Donnerstag, 18. März 2004 02:17
> An: [EMAIL PROTECTED]
> Betreff: returning hashes, and arrays
> 
> I'm having trouble returning a hash from a
> subroutine,
> and an array from a different subroutine. 
> "Beginning
> Perl" said I could return a list, I can't get it to
> work.  Must the hash and array really be a reference
> to the hash and array in order to return them?
> 
> 
> Here's my subroutine:
> sub ParseLineForHomeAndVisitors()
> {
>  if ($_
>
=~/(Spurs|Suns|Mavericks|Lakers|Clippers|Cavaliers|Celtics|Pacers|Piston
>
s|Wizards|Warriors|Bulls|Hawks|Raptors|Magic|Heat|Kings|Rockets|Nuggets|
> Grizzlies|Jazz|Knicks|Nets|Supersonics|'Trail
>
Blazers'|Bucks|Timberwolves|Hornets|Sixers|Bobcats)/)
>  {
>   @teams = /([[:alpha:]]+)/g;
>  }
>  return (@teams);
> }
> 
> ---------
> And here's how I'm trying to capture the value:
> 
> @teams = ParseLineForHomeAndVisitors();
> 
> ----
> 
> I tried the same thing with my hash:
> 
> CreateAbbrevAndNicknamesHash();
> 
> and here's the sub:
> 
> sub CreateAbbrevAndNicknamesHash()
> {
> my %AbbrevAndNicknames;
> %AbbrevAndNicknames = (
>       
> IND=> "Pacers",
>       
> NJN=> "Nets",
>       
> DET   =>      "Pistons",
>       
> NOH   =>      "Hornets", #check this
>       
> MIL   =>      "Bucks",
>       
> CLE   =>      "Cavaliers",
>       
> BOS   =>      "Celtics",
>       
> NYK   =>      "Knicks",
>       
> MIA   =>      "Heat",
>       
> PHI   =>      "Sixers",
>       
> TOR   =>      "Raptors",
>       
> ATL   =>      "Hawks",
>       
> WAS   =>      "Wizards",
>       
> ORL   =>      "Magic",
>       
> CHI   =>      "Bulls",
>       
> CHA   =>      "Bobcats",
>       
> SAC   =>      "Kings",
>       
> MIN   =>      "Timberwolves",
>       
> SAN   =>      "Spurs",
>       
> LAL   =>      "Lakers",
>       
> DAL   =>      "Mavericks",
>       
> MEM   =>      "Grizzlies",
>       
> HOU   =>      "Rockets",
>       
> DEN   =>      "Nuggets",
>       
> UTA   =>      "Jazz",
>       
> POR=> "Trail Blazers",
>       
> SEA   =>      "Supersonics",
>       
> LAC   =>      "Clippers",
>       
> GSW   =>      "Warriors",
>       
> PHX   =>      "Suns"
>       
> );
> 
> }
> 
> -----------
> 
> Any suggestions?
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - More reliable, more storage, less spam
> http://mail.yahoo.com
> 
> -- 
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> <http://learn.perl.org/>
> <http://learn.perl.org/first-response>
> 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> <http://learn.perl.org/>
> <http://learn.perl.org/first-response>
> 
> 


__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to