in reply to The file I want to open must be determined by a command line argument

Hello,
I hope this helps in some way.
I do a similar thing with a project I'm working on.
When a new user signs up I take the first letter of their name and then depending what it is, I open up a specific folder and file. I have files names "ag.dat" "hn.dat" and so on....
#FIND OUT WHAT THE FIRST LETTER OF USERNAME IS & #SET FILE NAME TO OPEN $_ = $username; if (/^[a-g]/i) { $filename = 'ag';} elsif (/^[h-n]/i) { $filename = 'hn';} elsif (/^[o-u]/i) { $filename = 'ou';} elsif (/^[v-z]/i) { $filename = 'vz';} elsif (/^[0-9]/i) { $filename = '09';} else { $errormsg = 'Cannot open file'; &Printerror;} #SET THE COMPLETE FILE DESTINATION $dirname = "/absoulute/path/$filename.dat"; #OPEN THE FILE open(FILEHANDLE, "$dirname");
Not sure if I've quite understood what your asking. Let me know.

ThAtH0M

  • Comment on Re: The file I want to open must be determined by a command line argument
  • Download Code