"anonymous" variable in Perl?

From: Ronald Fischer (ronaldf_at_eml.cc)
Date: 11/30/04


Date: 30 Nov 2004 01:29:08 -0800

Consider a call to, say, localtime, where I only need the current month:

my ($a, $b, $c, $d, $month) = localtime time,

Here I had to invent names ($a...$d) for the first four fields. Is it possible
in Perl to have kind of an "anonymous" variable as a placeholder for those
fields, similar to the '_' variable in Prolog?

I darkly remember to have read about such a feature introduced with Perl 5.6,
but I can't find out how to do it.

Ronald



Relevant Pages

  • Problem with timezone in Perl (and possibly elsewhere)
    ... A colleague reported the following problem, which I am attempting to relay as accurately as possible: When one sets the 'TZ' environment variable in one's Perl script, then calls localtime(), the time returned is correct for the chosen time zone. ... intended to be capable of handling timezone offsets. ... With this evidence it's clear that this problem is expressed on Debian ...
    (Debian-User)
  • Re: problems appending an entry to a logfile
    ... (given ym perl ability. ... localtime() returns a string containing the local time. ... i would like my logfile to look like ... perldoc -q "output of a command" ...
    (comp.lang.perl.misc)
  • Re: Small date question
    ... Why would you want to tie your hands behind your back and wear a ... Far from being well versed in perl, I wasn't sure and wanted suggestions by ... described in the man page of localtime, and use sprintf to enforce your ...
    (comp.lang.perl.misc)
  • Re: Better perl docs?
    ... > with perl. ... the QUALITY of the documentation will vary. ... already widely-used localtime function family ...
    (comp.lang.perl)
  • Re: Objects/Structures in Perl
    ... I am running this using ActiveState Perl 5.8.7.815 under Windows XP. ... return bless $self, $class; ... Is $time sort of an implicit variable. ... I looked at the "localtime" ...
    (comp.lang.perl.misc)