[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

RE: [FWP] Constants as array refs



On Mar 23, Jeff Boes said:

>Dunno which I like better... I've always been attracted to the idea of 'use
>constant', but the syntactical sugar is certainly lacking (IMO).

Is there a reason you need it to be an array reference?

  #!/usr/bin/perl
  use constant FOO => 1,2,3,4;

  print map $_ * 2, FOO;

  # or, for clarity:
  for (FOO) { print $_ * 2 }

2468

-- 
MIDN 4/C PINYAN, NROTCURPI, US Naval Reserve             japhy@pobox.com
http://www.pobox.com/~japhy/                  http://pinyaj.stu.rpi.edu/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe