Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Grabbing year and month from filename

by vinoth.ree (Monsignor)
on Aug 01, 2018 at 05:26 UTC ( #1219619=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $filename =~ /^(\d+)-(\d+)-(.*)/;
    my $year = $1;
    my $mon = $2;
    
    print("$year-$mon");
    
  2. or download this
    my $filename = "2010-7-this-is-an.html";
    my ($year, $mon) = split('-', $filename);
    print("$year-$mon");
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1219619]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2020-07-07 05:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?