Exforsys

Online Training

Unique File Names

This is a discussion on Unique File Names within the Perl forums, part of the Programming Talk category; I am using $filename = "$$" . "$^T" . ".html"; to name my file for my Perl application. ...


Go Back   Exforsys > Programming Talk > Perl

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-02-2007, 04:38 PM
Member
 
Join Date: Apr 2006
Posts: 98
Angela is on a distinguished road
Thumbs up Unique File Names

I am using
$filename = "$$" . "$^T" . ".html";

to name my file for my Perl application. Will this always guarantee uniqueness of filename? If not how can I handle generally to name unique file names?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-07-2007, 04:31 AM
Senior Member
 
Join Date: Apr 2006
Posts: 162
sammy is on a distinguished road
Yes this would ensure unique file name because in Perl the variable $$ denotes the process id that is used currently. In addition you have also used $^T which denotes current timestamp. So association of both these gives unique process id with current timestamp to filename making the filename as unique.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-07-2007, 04:56 AM
Senior Member
 
Join Date: Apr 2006
Posts: 145
Rahulbatra is on a distinguished road
Sammy I agree that the variables denote current process id and the current timestamp making filename as unique. But there is a small thing here for consideration. The process ids are unique only up to a certain number. After it reaches the maximum number allowed there is possibility of the process id getting repeated again. Also attaching timestamp though makes it unique filename I feel it would give a bad shape to the filename.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
testing of .net aplication naga_sri Testing Tutorials 1 02-16-2007 03:27 AM
Tutorial on Silk Test spriya279 Testing Tutorials 2 02-15-2007 07:31 PM
Apple II Csa2 FAQs: Uploading & Downloading, Part 21/25 rubywand@swbell.net Tech FAQ 0 05-04-2004 10:01 AM
Apple II Csa2 FAQs: Error List, Part 8/25 rubywand@swbell.net Tech FAQ 0 05-04-2004 10:01 AM
Solaris x86 FAQ 2/2 Dan Anderson Tech FAQ 0 04-27-2004 08:24 PM


All times are GMT -4. The time now is 12:04 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.