best Perl syntax
Dave Lawrence
dkl at redhat.com
Thu Jun 19 16:41:04 UTC 2008
On Thu, 2008-06-19 at 12:17 -0400, Tosh, Michael J wrote:
> Can someone please help me fix this code, seems a little repetitive:
>
> my @labs = qw/ lab1 lab2 /;
> my @days = qw/ Monday Tuesday Wednesday Thursday Friday Saturday
> Sunday /;
>
> $vars->{'labs'} = \@labs;
> $vars->{'days'} = \@days;
>
> Isn't there a better way to write that?
>
$vars->{'labs'} = [qw/ lab1 lab2 /];
$vars->{'days'} = [qw/ Monday Tuesday Wednesday Thursday Friday
Saturday/];
Dave
--
David Lawrence, RHCE dkl at redhat.com
------------------------------------
Red Hat, Inc. Web: www.redhat.com
1801 Varsity Drive Raleigh, NC 27606
More information about the developers
mailing list