#!/usr/bin/perl use 5.016; use warnings; # 1071410 change ONLY numbers which are (one digit only) 0 my @arr = qw(20 14 007 0 1203 '' 7900130 43.02 0.03 0.0 ); for my $elem(@arr) { if ( $elem=~ /^0{1}$/ ){ say $elem; my $elem1 = $elem =~ s/^0{1}$/1/; say $elem1; } } say "above, results from Ln1-14; below: Kenosis' 3: \n"; my @arr3 = qw(20 14 007 0 1203 '' 7900130 43.02 0.03 0.0 ); for (@arr3) { print "Original \@arr3 element: |$_| becomes (or remains as) "; $_ = 1 if $_ == 0; say $_; } say "\n Kenosis' 1 (boundary version): "; my @arr1 = qw(20 14 007 0 1203 '' 7900130 43.02 0.03 0.0 ); for (@arr1) { s/\b0\b/1/; print "Original \@arr1 element: |$_| becomes (or remains as) "; say $_; }