Hi -

Putting a value or variable alone on the last line
of a scope like:

sub something
{
 blah, blah, blah...
 ...
 1;
}

implies 'return 1;'. The subroutine (or scope) returns
the value last evaluated.

The function 'exit' or 'exit 99' does just that,
exits the script to the os (or whoever called it
with 'system' or ``) with the return code given.

Aloha => Beau.

PS: As an old-time c/c++ programmer this confused me
too in my earlier days with perl.

-----Original Message-----
From: Mystik gotan [mailto:[EMAIL PROTECTED]]
Sent: Saturday, November 23, 2002 11:19 AM
To: [EMAIL PROTECTED]
Subject: Some few basic Perl questions


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?
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?

Think I've kinda missed these usements on Perl ;-)

Thanks for your help, already.



_________________________________________________________________
Direct chatten met je vrienden met MSN Messenger  http://messenger.msn.nl


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to