"Fossies" - the Fresh Open Source Software Archive

Member "RPerl-5.002000/lib/RPerl/Test/Operator10NamedUnaryExists/program_20_good.pl" (29 Nov 2019, 1253 Bytes) of package /linux/misc/RPerl-5.002000.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/env perl
    2 
    3 # [[[ PREPROCESSOR ]]]
    4 # <<< TYPE_CHECKING: ON >>>
    5 # <<< EXECUTE_SUCCESS: "have $key_does_exist = TRUE" >>>
    6 # <<< EXECUTE_SUCCESS: "have $key_does_not_exist = FALSE" >>>
    7 
    8 # [[[ HEADER ]]]
    9 use RPerl;
   10 use strict;
   11 use warnings;
   12 our $VERSION = 0.001_000;
   13 
   14 # [[[ CRITICS ]]]
   15 ## no critic qw(ProhibitUselessNoCritic ProhibitMagicNumbers RequireCheckedSyscalls)  # USER DEFAULT 1: allow numeric values & print operator
   16 ## no critic qw(RequireInterpolationOfMetachars)  # USER DEFAULT 2: allow single-quoted control characters & sigils
   17 
   18 # [[[ OPERATIONS ]]]
   19 
   20 # homogeneous 2-dimensional hash of arrays of integers
   21 # DEV NOTE: must be on single one to match auto-generated Perl::Tidy output code
   22 my integer_arrayref_hashref $foo = { key_0 => [ 0, 1, 2, 3, 4 ], key_1 => [ 5, 6, 7, 8, 9 ], key_2 => [ 0, -1, -2, -3, -4 ], key_3 => [ -5, -6, -7, -8, -9 ] };
   23 
   24 my boolean $key_does_exist     = exists $foo->{key_0};
   25 my boolean $key_does_not_exist = exists $foo->{key_X};
   26 
   27 if ($key_does_exist) {
   28     print 'have $key_does_exist = TRUE', "\n";
   29 }
   30 else {
   31     print 'have $key_does_exist = FALSE', "\n";
   32 }
   33 
   34 if ($key_does_not_exist) {
   35     print 'have $key_does_not_exist = TRUE', "\n";
   36 }
   37 else {
   38     print 'have $key_does_not_exist = FALSE', "\n";
   39 }
   40 
   41