[H-GEN] couple of small perl questions
Tony Nugent
tony at linuxworks.com.au
Thu Jan 16 16:34:54 EST 2003
[ Humbug *General* list - semi-serious discussions about Humbug and ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]
Can anyone tell me how to do this?
I have a text file that I'm reading in, it is created by a windows
program so it has CR-LF terminated lines. The chomp and chop
functions don't seem to work to get rid of them... do I have to
resort to specifically removing them from the end of each line with
a regexp deletion of the \015\012 characters? (In other words, I'd
like a perl snippit that basically does an on-the-fly dos2unix
conversion).
Also, I'd like to get the called name of the actual script from
within the program... unlike shell scripts (using $0 to refer to its
called name), ARGV[0] refers to the first command line arguement.
The script I'm writing will be "multi-functional" in that it will be
hard-linked with several different names, and I want it to act
differently depending on its called name. And can the same thing be
done with modules, is it possible for an external module (or even a
perl function) to identify its own called name?
Thanks for any pointers.
Cheers
Tony
--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'. See http://www.humbug.org.au/
More information about the General
mailing list