Help understanding some Perl code.

Well, I found myself trying to fix some Perl code (Ive never done any Perl in my life) and I pinpointed the place where the bug could be. But to be sure I have to know what does a few line of code mean:

$files_lim =~ (/^\d*$/)
$files_lim =~ (/^\d*h$/)
$files_age =~ s/h//

The code where this was pulled out just tries to erase a file thats more than 10 days old.

Thanks in advance.

I believe the first two match digits at the end of a string, the first one without h on the end, the second with h on the end. Possibly with intention of grabbing it from the $1 etc specials later.

The third deletes any 'h' characters in the string.

Without more context it's difficult to explain why they're doing that.

Especially when you could just use find.

1 Like

My bad I reposted this in the PERL and scripting section afraid that I had posted it in the wrong one.

Well these lines are part of a BIG perl routine previously created, and I do understand whats happening before and after. I just wasnt sure what was happening in with these lines.

Thanks for the quick response!