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|Pistons|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>
