On Thu, Nov 22, 2018 at 12:33:25PM -0800, John W. Krahn wrote:
> On 2018-11-22 8:08 a.m., David Precious wrote:
> >
> > You'll often see these operators used to provide default values.
> >
> > e.g.
> >
> > sub hello {
> > my $name = shift;
> > $name ||= 'Anonymous Person';
>
> Which is usually written as:
>
> sub hello {
> my $name = shift || 'Anonymous Person';
Or, nowadays, and if your perl version(s) support it, as:
sub hello ($name = "Anonymous Person") {
--
Paul Johnson - [email protected]
http://www.pjcj.net
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/