[Chicago-talk] is this still on?

James E Keenan jkeenan at pobox.com
Sun May 17 12:01:45 PDT 2020


On 5/17/20 12:49 PM, Jay S wrote:
> Hi Perl mongers, I'm not sure if this list is still on|active.
> I hope everyone is doing well and staying sane.
> I haven't programmed in a long time and can't remember stuff.  How do 
> make a list out of a hash?
> 
> Instead of:
> my $ClubID = $data{ClubID};
> my $GameCode = $data{GameCode};
> my $DateStarted = $data{DateStarted};
> my $GameType = $data{GameType};
> 
> I'd like to do something like this but can't remember the proper 
> incantation:
> my ($ClubID, $GameCode, $DateStarted, $GameType) = @data(qw[ClubID 
> GameCode DateStarted GameType]);
> 

You probably want:

my ($ClubID, $GameCode, $DateStarted, $GameType) =
   @data{qw[ClubID GameCode DateStarted GameType]};

i.e., braces instead of parens to indicate hash slice.


More information about the Chicago-talk mailing list