use v5.18;
BEGIN {
use List::MoreUtils qw| any |;
use Scalar::Util qw| looks_like_number |;
use Fatal qw| open |;
}
sub mySub {
say "This is mySub, foo!";
}
####
#!/usr/bin/perl
use v5.18;
BEGIN {
do 'MyInit.pl';
}
mySub();
my @array = ( 'one', 'two', 'three' );
if( any {$_ eq 'two'} @array ) {
say 'So far so good...';
}
if( looks_like_number( "five" ) ) {
say 'Hmm...';
}
else {
say 'Perl can\'t read.';
}
open( my $dne, '<', 'nonexistentfile.txt' );
die 'Failed to import autodie';
##
##
peter@hermes:~/src/Perl/test> perl myscript.pl
This is mySub, foo!
So far so good...
Perl can't read.
Can't open(GLOB(0x9cc7d8), <, nonexistentfile.txt): No such file or directory at (eval 3) line 4.
main::__ANON__('GLOB(0x9cc7d8)', '<', 'nonexistentfile.txt') called at myscript.pl line 22