in reply to XLSX retriving if matches

An old-school way to do it is to:

  1. Initialize an array at the start of each row;
  2. Initialize a processing flag to false at the start of each row;
  3. Push each cell into that array as it is processed during the inner loop;
  4. Set the processing flag to true when you have your $patternmatch;
  5. At the bottom of the row loop, after processing all the cells in that row, if the flag is set, the array contains the complete row so use it accordingly.

my ( $row_min, $row_max ) = $worksheet->row_range(); my ( $col_min, $col_max ) = $worksheet->col_range(); for my $row ( $row_min .. $row_max ) { my @rowcells = (); # Initialize array at start of new + row my $process_flag = 0; # Initialize processing flag to fa +lse for my $col ( $col_min .. $col_max ) { my $cell = $worksheet->get_cell( $row, $col ); if ($cell) { push @rowcells, $cell; # Save cell in case we need it if($cell->value eq $pattern) { $process_flag = 1; # We will need this line once it's + collected } } else { push @rowcells, ''; # Assuming undef is not a useful o +ption } if ($process_flag) { # Do something with @rowcells, which now contains the whole li +ne } }