From: "Mystik gotan" <[EMAIL PROTECTED]> > Hiya, > > I got some basic Perl questions. Hope you don't mind answerring them? > > 1) What is the use of just putting $var; on 1 line? Example: > #!usr/bin/perl -wT > > # some code > $var; > > Does this technique rescopes the variable?
No. It doesn't do anything. (Unless the $var variable is tie()d to something. See perltie manpage if feeling adventurous.) > 2) Why is exit() or 1; used on the LAST line. I understand it being on > some line when you need to exit. Also, exit() won't be too hard. I > think (and I think I am possibly right), it exits because there are > still some operations during. But why 1; on the end of the line? Does > it wait for a true value of the whole script? The exit() or exit(number) simply exits the script, no matter how deep in the function calls or loops you are. The 1; is used in modules or snipets of code that are supposed to be use()d, require()d or do()ne. The 1; tells Perl that the module/code was loaded fine. This is because of a very rarely used feature ... if you use some conditional expression or a variable or something instead of the 1; then the expression would be evaluated and if it returns a false value Perl will exit with an error message. For example if the module only works under WinNT/Win2k/WinXP and not under Win9x it may end with something like: Win32::IsWinNT(); And if you try to use it under Win9x you'll get something like: .... did not return a true value at .... line .... HTH, Jenda ===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz ===== When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]