Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use warnings;
- use strict;
- my @a = (1, 2, 3, 4, 5);
- my @b = (1, 2, 3, 4, 5);
- my @c = (1, 2, 3, 4, 5);
- sub check_same (\@\@) {
- my ($ref_one, $ref_two) = @_;
- return 0 unless @$ref_one == @$ref_two;
- for my $elem (0..$#$ref_one) {
- return 0 unless $ref_one->[$elem] eq $ref_two->[$elem];
- }
- return 1;
- }
- print "\@a Is Desame To \@b\n" if check_same(@a, @b);
- print "\@a Is Desame To \@c\n" if check_same(@a, @c);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement