Logo
  • Home
  • About
  • Services
  • Blogs
  • Career
  • Contact
Logo

The UK's #1 Software Development Company. PodTech IO builds custom software solutions for businesses. Call today for a free consultation

  • Address

    4th Floor, 4 Tabernacle Street London EC2A 4LU
  • Email

    info@podtech.com
  • Contact

    +44 (0) 20 8720 6583

Perl – Compare Array Contents when length is identical and order matches

  • Home
  • Perl – Compare Array Contents when length is identical and order matches
  • By podtech
  • In Perl

Perl – Compare Array Contents when length is identical and order matches

Comparing arrays side by side. Do they match or dont they?
@a=(1,0,1,0,0);
@b=(0,0,1,0,0);

NO!

@arr1=(0,1,1,1,1,1,0,1);
@arr2=(0,1,1,1,1,1,0,1);

use Algorithm::Diff qw( LCS_length);
my $arr_count1 = @arr1;
my $arr_count2 = @arr2;

if($arr_count1 != $arr_count2) {
print “NOMATCH\n”; ## NO MATCH
} else {
$count = LCS_length (\@arr1,\@arr2);
if ($arr_count1 eq $count) {
print “MATCH\n”; ## identical arrays
} else {
print “NOMATCH\n”; ## NO MATCH
}
}

ArrayArray ContentsCompare ArrayCompare Array Contents when length is identical and order matchesPerlPerl Compare Array Contents when length is identical and order matches
Perl – Code Execution Time with accuracy – Time::HiRes
Ubuntu – Update OpenSSL – Fix HeartBleed Vulnerability

Recent Posts

  • What is Software Piracy?
  • Microsoft and SITA Launch New Innovation Center in South Africa
  • Ericsson, Qualcomm and Thales to Launch 5G into Space
  • Schneider Electric Launches Free Data Center Professional Education Platform
  • UK and South Korea Reach Data Sharing Agreement

PodTech IO

The UK's #1 Software Development Company. PodTech IO builds custom software solutions for businesses. Call today for a free consultation

Company

  • About
  • Services
  • Contact
  • Blogs
  • Career

Terms

  • Terms & Conditions
  • Privacy Policy

Contact Us

  • ADDRESS

    Headquarter: Tabernacle Street London India: Vi john Tower, Gurgaon, Haryana
  • EMAIL

    info@podtech.com
  • CONTACT

    +44 (0) 20 8720 6583

Copyright ©2022 PodTech IO. All Rights Reserved

Logo