in reply to Re^2: any replacements for smartmatch on comparing two arrays
in thread any replacements for smartmatch on comparing two arrays

You can always "inspire" yourself by looking at the source of List::Compare or Data::Compare and then include their code bodily into your script.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics
  • Comment on Re^3: any replacements for smartmatch on comparing two arrays

Replies are listed 'Best First'.
Re^4: any replacements for smartmatch on comparing two arrays
by stevieb (Canon) on Sep 24, 2015 at 17:08 UTC

    I just tested this with Data::Compare. To use the Compare function, all that is required is appending the Compare sub contents from the Data::Compare source into the script following this required code (note that both Carp and Scalar::Util have been in core since pre-5.8).

    use warnings; use strict; use Carp; use Scalar::Util; my (%been_there, %handler); print Compare([], [qw(1 2)]);