my $rvars = \%vars; ## this function is to be debugged using the perl debugger my $return2 = make_initial_captions($rvars); say "return2 is $return2"; #### package utils1; require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw( invert_aoa print_hash print_aoa highest_number ); sub invert_aoa{ use strict; use warnings; use 5.010; my $a = shift; my @AoA = @$a; my $k = $#AoA; #say "k is $k"; my @BoB; for my $i ( 0 .. $#AoA ) { my $aref = $AoA[$i]; my $x = $#{$aref}; #say "x is $x"; for my $j ( 0 .. $#{$aref} ) { $BoB[$j][$i]= $AoA[$i][$j]; } } my $b = \@BoB; return $b; } sub print_aoa{ use warnings; use 5.011; my $a = shift; my @AoA = @$a; for my $i ( 0 .. $#AoA ) { my $aref = $AoA[$i]; for my $j ( 0 .. $#{$aref} ) { print "elt $i $j is $AoA[$i][$j]\n"; } } return $a; } sub highest_number{ use strict; use File::Basename; use Cwd; my ($aref, $filetype, $word) = @_; my $number; my @matching; my $ext = ".".$filetype; push (@matching, 0); #min returned value for my $file (@{$aref}) { #print "file is $file\n"; if ($file =~ /^$word(\d+)$ext$/){ #print "matching is $file\n"; push (@matching, $1); } } @matching = sort @matching; my $winner = pop @matching; return $winner } sub print_hash{ use 5.011; my $hash_ref = shift; ## 10-15-18 adding sorted keys print "subroutine says this is your hash: \n"; my %hash = %$hash_ref; foreach my $name (sort keys %hash) { say "key: $name, value: $hash{$name}\n"; } } 1; #### sub make_initial_captions { use 5.016; use warnings; use POSIX; use Path::Tiny; use Encode; use open OUT => ':encoding(UTF-8)', ':std'; use Data::Dumper; my $rvars = shift; my %vars = %$rvars; #print Dumper $rvars; my $image_path = $vars{"to_images"}; my $caption_path = $vars{"eng_captions"}; # put a break point here $DB::single = 1; return "nothing yet"; } #### $ perl -d 1.debug.11.pl Loading DB routines from perl5db.pl version 1.55 Editor support available. Enter h or 'h h' for help, or 'man perldebug' for more help. Subroutine debug1::getcwd redefined at /usr/share/perl/5.30/Exporter.pm line 66. at template_stuff/debug1.pm line 400. debug1::BEGIN() called at template_stuff/debug1.pm line 400 eval {...} called at template_stuff/debug1.pm line 400 require debug1.pm called at 1.debug.11.pl line 4 main::BEGIN() called at template_stuff/debug1.pm line 400 eval {...} called at template_stuff/debug1.pm line 400 main::(1.debug.11.pl:12): my $ts = "template_stuff"; DB<1> n main::(1.debug.11.pl:13): my $images = "aimages"; DB<1> c title is 1.debug.1 path1 is /home/hogan/6.scripts/1.debug.1 abs is /home/hogan/6.scripts/1.debug.1/1.debug.11.pl debug1::make_initial_captions(template_stuff/debug1.pm:43): 43: return "nothing yet"; ... DB<3> p $vars{to_images} /home/hogan/6.scripts/1.debug.1/template_stuff/aimages DB<4> p $vars{eng_captions} /home/hogan/6.scripts/1.debug.1/template_stuff/captions DB<5> c return2 is nothing yet ini path is /home/hogan/Documents/html_template_data/6.values.ini ...[normal execution] return is 1.debug.13.html http://www.merrillpjensen.com/perlmonks/1.debug.13.html Debugged program terminated. Use q to quit or R to restart, use o inhibit_exit to avoid stopping after program termination, h q, h R or h o to get additional info. DB<5> q $