my $IP = '127.0.0.1';
my $abs_IP = sprintf "%03d"x4, split /\./, $IP;
Avoid map for simple stuff. The "%03d"x4 above is computed during compilation. Also, avoid loops at runtime.
You should also consider using the resutling string as a prefix of the resulting filename for security reasons. There is File::Temp for that.
UPDATE: Ignoring the fact that this might not be as useful as one might think, you should really use a database for this type of job. It's a lot safer, faster and scalable.
It depends on what you store in each file. If you store small records of just a few bytes, you could be using 2k or 4k (or more) of disk space for each file according to your fs blocksize. Take a look to DB_File for more info. |