[Chicago-talk] Using a hash in a regex

Jay Strauss me at heyjay.com
Thu Jul 13 14:01:50 PDT 2006


Just to be clear.  I have a bunch of files in a directory.  The filename
has within it (somewhere) a key(word) like: "income".  I need to
sequence these files in a specified order.  So I use a hash like:

%h = (... income=> 13 ...); # the ... are not Perl

Then I glob my directory and get a filename like:

$filename = "bank statements used for income.pdf"

So I change the filename to be:

"13.bank statements used for income.pdf"

And then I'm onto the next file

Thanks
Jay



> -----Original Message-----
> From: Andy Lester [mailto:andy at petdance.com] 
> Sent: Thursday, July 13, 2006 3:46 PM
> To: Chicago.pm chatter
> Cc: Jay Strauss
> Subject: Re: [Chicago-talk] Using a hash in a regex
> 
> 
> 
> On Jul 13, 2006, at 3:43 PM, Randal L. Schwartz wrote:
> 
> > That replaces "this" with "1" in the string.  I *think* that's what
> > you want.
> > It's not exactly what you said.  But it's what would likely 
> be in the
> > archive. :)
> 
> But he doesn't want a replacement.  He just wants a lazy non-looping  
> way to check all the regexes in a hash.
> 
> --
> Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance
> 
> 
> 
> 



More information about the Chicago-talk mailing list