Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: How to get 0 to initialize a value

by Marshall (Abbot)
on Apr 30, 2019 at 21:36 UTC ( #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
Node Status?
node history
Node Type: note [id://1233207]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2019-10-17 15:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?