John W. Krahn wrote:
> [EMAIL PROTECTED] wrote:
> >
> > Does the semicolon behave any differently for a return test statement?
> >
> > Example,
> >
> > sub validate
> > { return shift =~ /^[a-zA-Z0-9][\w-]*\.[a-zA-z]+$/ }
> >
> > or
> >
> > sub validate
> > { return shift =~ /^[a-zA-Z0-9][\w-]*\.[a-zA-z]+$/; }
>
>
> Trailing commas and semicolons are optional.
>
> ( 1, 2, 3, 4 ) is the same as ( 1, 2, 3, 4, ) and { statement1;
> statement1; statement1 } is the same as { statement1; statement1;
> statement1; }

Yes. A the semicolon is a statement separator in Perl. Unlike C,
where it is a statement terminator and the final semicolon is
required. Null statements are also allowed, so

  ( return 99; }

is the same as

  { return 99 }

or

  { return 99; ; ; ; ; ; ; }

HTH,

Rob



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

Reply via email to