Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: How to get 0 to initialize a value

by Marshall (Canon)
on Apr 30, 2019 at 21:36 UTC ( [id://1233207]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    use strict;
    ...
    my $nothing2;
    $nothing2 = '' if !defined $nothing2; # pre Perl 5.10
    print "$nothing2\n";
    
  2. or download this
    my $first_type = $first_book =~ /^M/ ? 'major' : $first_book =~ /^m/  
    +? 'mentioned' : undef;
    
    ...
    my $first_type = 'major'  if $first_book =~ /^M/;
    $first_type = 'mentioned' if $first_book =~ /^m/;
    $first_type //= 'unknown';
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1233207]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2024-03-28 17:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found