in reply to "Use of uninitialized value in pattern match (m//)" warning, doing a grep on 2D array
Works fine for me on 5.34:
#!/usr/bin/env perl use strict; use warnings; use Test::More tests => 1; use Test::NoWarnings; my @matrix = ( [1, 2], [3, 4] ); my $to_keep = 3; my @matrix_filtered = grep { $_->[0] =~ /$to_keep/ } @matrix;
Perhaps your data do actually have uninitialized values. See also How to ask better questions using Test::More and sample data.
🦛
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: "Use of uninitialized value in pattern match (m//)" warning, doing a grep on 2D array
by soblanc (Acolyte) on Oct 14, 2022 at 14:39 UTC | |
by hippo (Archbishop) on Oct 14, 2022 at 14:47 UTC |