Skip to content

Instantly share code, notes, and snippets.

View Util's full-sized avatar

Bruce Gray Util

View GitHub Profile
@Util
Util / Notes
Last active December 19, 2015 01:58 — forked from Woody2143/Schwartzian.pl
A reply to the original (prefork) version.
1. Spelling corrected: Schwartzian transform
2. No need to use parens around \d{8}.
3. I like ST better, but GRT is faster for large lists:
http://www.perlmonks.org/?node_id=145659
4. Need to warn or die to show bad data when regex fails.
5. Perl 6 automatically does ST for you:
my @sorted = @files.sort({ / SWITCH _ \d**8 _ (\d**6) / or die; $0; });
package DateRange;
# Usage: `use DateRange qw( getDateArray );`
use strict;
use warnings;
use base qw(Exporter);
our $VERSION = 1.00;
our @EXPORT_OK = qw( &getDateArray );
sub getDateArray {