perlmeditation
AcidHawk
HaHaHa,<p>
In my quest recently to find a way of encrypting and decrypting a string in perl. I came accross this GEM of a web site <a href="http://perl.plover.com/IAQ/IAQlist.html">Infrequently Asked Questions About Perl</a> </p><p>I was searching for "perl string decrypt" and came across this page that has this </p><b>How do I decrypt a string that I encrypted with crypt()? </b><p>I thought I had struck gold. This is exactly what I had been looking for, for hours.</p><p>I looked at the code in his solution and thought ... jeesh I am going to need to concentrate on this.!..<br>This is what it looked like.</p>
<code>
sub decrypt {
my $c = shift;
my @c = (0) x 8;
for (;;) {
my $i = 0;
my $s = join '', map chr, @c;
return $s if crypt($s, $c) eq $c;
$c[$i]=0, $i++ while $c[$i] == 255;
return undef if $i > 7;
$c[$i]++;
}
}
</code></p>A <b>Warning</b> even followed.</p><p><b>Warning:</b> Exporting this function outside the USA may be illegal under the provisions of ITAR.</p>I loaded the code into my editor and as I was about to start I noticed the question below the one I was interested in,</p><p>How do I get my perl program to run faster?</p><p>
<code>
use more 'cpu';
use less 'time';
use more 'speed';
</code></p>No!!! It can't be... I have never seen those used before...</p><p>It was only then that I started to read the page from the begining...</p><p>My best is... </p><p>
How do I get tomorrow's date?</p>Use this function:
<code>
sub tomorrow_date {
sleep 86_400;
return localtime();
}
</code><br>
There must be tons more of this stuff out there, as soon as I get a gap I am going to search for it.<br>
-----<BR>
Of all the things I've lost in my life, its my mind I miss the most.