Re: Convert any date format to ISO

2013-07-24 Thread Michael Brader
On 07/25/2013 03:26 PM, Jim Gibson wrote: You don't need a module to recognize a date in the form DD-MM- and change it into the form -MM-DD (untested): if( $date =~ /^(\d\d)-(\d\d)-(\d\d\d\d)$/ ) { $date = "$3-$2-$1"; }else{ # try other conversions } Jim's right, but be aware

Re: Convert any date format to ISO

2013-07-24 Thread Jim Gibson
On Jul 24, 2013, at 5:44 PM, mimic...@gmail.com wrote: > I was trying to use Date::Simple to convert date from DD-MM- to ISO > standard -MM-DD, but it produced error below because it returned undef > when the date passed is not ISO standard. You don't need a module to recognize a date

Re: Convert any date format to ISO

2013-07-24 Thread Michael Brader
On 07/25/2013 10:14 AM, mimic...@gmail.com wrote: I was trying to use Date::Simple to convert date from DD-MM- to ISO standard -MM-DD, but it produced error below because it returned undef when the date passed is not ISO standard. Yeah on quick scan of the perldoc it looks like Date:

Re: Unable to understanding map usage

2013-07-24 Thread *Shaji Kalidasan*
Rajeev, There is a typo in formatting. So here is the complete working code. I apologize for any inconvenience caused. Courtesy : Jim Gibson and Shawn H Corey for the detailed explanation [code] use strict; use warnings; my @data = qw/                 "apples"                 oranges          

Re: Convert any date format to ISO

2013-07-24 Thread mimic...@gmail.com
I was trying to use Date::Simple to convert date from DD-MM- to ISO standard -MM-DD, but it produced error below because it returned undef when the date passed is not ISO standard. $ perl -e 'use Date::Simple (":all");$date = Date::Simple->new("29-01-1972"); $x = $date->as_iso; print "

Re: Unable to understanding map usage

2013-07-24 Thread *Shaji Kalidasan*
Rajeev, Here is a complete working code which explains the details. Courtesy : Jim Gibson and Shawn H Corey for the detailed explanation [code] use strict; use warnings; my @data = qw/                 "apples"                 oranges                 "guavas"                 cherri"es          

Re: Unable to understanding map usage

2013-07-24 Thread Jim Gibson
On Jul 24, 2013, at 12:33 PM, Shawn H Corey wrote: > On Wed, 24 Jul 2013 12:25:16 -0700 > Jim Gibson wrote: > >> In your case, BLOCK is >> >> { $_=~ s/\"/\'/g; "\"$_\"" } >> >> and LIST is @data. Therefore, each element of @data is aliased to $_, >> the substitution s//\"/\'/g is performed

Re: Unable to understanding map usage

2013-07-24 Thread Shawn H Corey
On Wed, 24 Jul 2013 12:25:16 -0700 Jim Gibson wrote: > In your case, BLOCK is > > { $_=~ s/\"/\'/g; "\"$_\"" } > > and LIST is @data. Therefore, each element of @data is aliased to $_, > the substitution s//\"/\'/g is performed on it, which changes all > double-quote characters to single-qu

Re: Unable to understanding map usage

2013-07-24 Thread Jim Gibson
On Jul 24, 2013, at 11:44 AM, Rajeev Kilaru wrote: > Hello, > > I am looking at the following code someone wrote and I have > difficultly in understand map usage. Can somebody please explain how > does the following code work? > > print OUT2 join( ',', map { $_=~ s/\"/\'/g; "\"$_\"" } @data )

Re: module installation dir, site_perl, and perl -V:sitelib

2013-07-24 Thread Luca Ferrari
On Wed, Jul 24, 2013 at 2:28 PM, Christophe Martin wrote: > Do all (or 95%) of perl installation have a site_perl dir ? I'll bet the answer is not. However, what would make sitelib so much important with regard to other @INC entries? I mean, using a non-arch directory is fine without any regard

Unable to understanding map usage

2013-07-24 Thread Rajeev Kilaru
Hello, I am looking at the following code someone wrote and I have difficultly in understand map usage. Can somebody please explain how does the following code work? print OUT2 join( ',', map { $_=~ s/\"/\'/g; "\"$_\"" } @data ) Thanks, Rajeev Kilaru -- To unsubscribe, e-mail: beginners-unsub

module installation dir, site_perl, and perl -V:sitelib

2013-07-24 Thread Christophe Martin
Hello list. I am trying to install things in /usr/local/lib/site_perl as it seems from http://www.perlmonks.org/?node_id=256995 that this is the directory for locally installed modules. Now, If I use perl -V:sitelib on my ubuntu box, the answer is sitelib='/usr/local/share/perl/5.14.2'; I'd rathe