in reply to Re^2: Warnings not working on one machine
in thread Warnings not working on one machine
cat test2.pl #!/usr/bin/perl use strict; use warnings; use Cwd; use File::Basename; use List::Util qw(min max); use Math::Round; use Sort::Key::Natural qw(natsort); use Storable 'dclone'; use Sys::Hostname; use Term::ANSIColor; print "decimal places: ".length(("1" =~ /\.(\d*)/)[0])."\n"; print "decimal places: ".length(("0.123" =~ /\.(\d*)/)[0])."\n"; my $line = "apple="; my $second_part = (split(/=/, $line))[1]; my $second_part_components_count = (length $second_part > 0 ? scalar ( +split(/;/, $second_part)) : 0); print "done\n"; cat test3.pl #!/usr/bin/perl use strict; use warnings; use Cwd; use File::Basename; use List::Util qw(min max); use Math::Round; use Sort::Key::Natural qw(natsort); use Storable 'dclone'; use Sys::Hostname; use Term::ANSIColor; require "test3_utils.pl"; do_foo(); do_bar(); print "done\n"; cat test3_utils.pl #!/usr/bin/perl sub do_foo { print "decimal places: ".length(("1" =~ /\.(\d*)/)[0])."\n"; print "decimal places: ".length(("0.123" =~ /\.(\d*)/)[0])."\n"; } sub do_bar { my $line = "apple="; my $second_part = (split(/=/, $line))[1]; my $second_part_components_count = (length $second_part > 0 ? scal +ar (split(/;/, $second_part)) : 0); } 1; # need to end with a true value
I would expect the same results and the same warnings on both machines. To my surprise, neither is the case. The SciLnx is returning 0 where the Ubuntu machine is returning nothing.me@UbuntuMachine: ./test2.pl Use of uninitialized value in concatenation (.) or string at ./test2.p +l line 14. decimal places: decimal places: 3 Use of uninitialized value $second_part in numeric gt (>) at ./test2.p +l line 19. done me@UbuntuMachine: ./test3.pl decimal places: decimal places: 3 done me@SciLnxMachine: ./test2.pl Use of implicit split to @_ is deprecated at ./test2.pl line 19. Use of uninitialized value in length at ./test2.pl line 14. decimal places: 0 decimal places: 3 Use of uninitialized value $second_part in length at ./test2.pl line 1 +9. done me@SciLnxMachine: ./test3.pl decimal places: 0 decimal places: 3 done
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Warnings not working on one machine
by poj (Abbot) on Jan 26, 2018 at 13:57 UTC | |
|
Re^4: Warnings not working on one machine
by hippo (Archbishop) on Jan 26, 2018 at 13:57 UTC | |
by questions (Initiate) on Jan 29, 2018 at 15:10 UTC | |
by hippo (Archbishop) on Jan 29, 2018 at 15:50 UTC |