Hey Richard, I think $< returns user id. Correct me if I'm wrong ;-).
Rajnikant Jachak | Software Engg | Persistent Systems Limited [EMAIL PROTECTED] | Cell: +91 9822204088 | Tel: +91 (20) 3023 2479 Persistent Systems - Innovations in software product design,development and delivery - www.persistentsys.com -----Original Message----- From: Richard Lee [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 02, 2008 11:50 AM To: Randal L. Schwartz Cc: Rajnikant; beginners@perl.org Subject: Re: user id validation Randal L. Schwartz wrote: >>>>>> "Rajnikant" == Rajnikant <[EMAIL PROTECTED]> writes: >>>>>> > > Rajnikant> Is there any such way to get home directory of user? > > Is there any such way that this might be, perhaps, oh, a FAQ? > > Oh, yes, let's see. > > $ perldoc -q tilde > Found in /usr/libdata/perl5/pod/perlfaq5.pod > How can I translate tildes (~) in a filename? > > Use the <> (glob()) operator, documented in perlfunc. Older versions of > Perl require that you have a shell installed that groks tildes. Recent > perl versions have this feature built in. The File::KGlob module > (available from CPAN) gives more portable glob functionality. > > Within Perl, you may use this directly: > > $filename =~ s{ > ^ ~ # find a leading tilde > ( # save this in $1 > [^/] # a non-slash character > * # repeated 0 or more times (0 means me) > ) > }{ > $1 > ? (getpwnam($1))[7] > : ( $ENV{HOME} || $ENV{LOGDIR} ) > }ex; > > OK, so you may have not known "tilde". But you should be reading the > FAQ titles at least weekly until you are bored to tears from them, and > probably reading the entire FAQ at least bi-monthly. > > thanks guys!! But I guess there is no way to get user id.. ? I will read FAQ more... (till I am bored to tears ? :-) ) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/