Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Perl delete function

by Anonymous Monk
on Dec 23, 2013 at 06:23 UTC ( #1068141=note: print w/replies, xml ) Need Help??

in reply to Perl delete function

Not clear! Can you show us your code?

Replies are listed 'Best First'.
Re^2: Perl delete function
by annel (Novice) on Dec 23, 2013 at 06:39 UTC
    Please refer to my updated post. Thanks.
      Keys in hashes are unique, so you never had more than one "apple" in hash %m2.

      But it's still unclear which logic you expect, because thats a perfect set operation.

      Could it be that you want to compare arrays one by one by position?

      Then please use a loop to do so.

      Cheers Rolf

      ( addicted to the Perl Programming Language)

        Yes, I would like to compare the arrays one by one by position. I have attempted following:
        use strict; use warnings; open (FILE, "a") or die "Unable to open ref file.\n"; my @data1 =<FILE> ; close(FILE); open (FILE, "b") or die "Unable to open new file.\n"; my @data2 =<FILE> ; close(FILE); my $i; for( $i = 0; $i < 2; $i++){ if ($data1[$i] ne $data2[$i]){ print "Mismatch for $data1[$i] and $data2[$i]\n"; exit; } }
        But the error occurs when file 1 contains one line and file 2 contains 2 lines.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1068141]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (1)
As of 2023-04-02 11:02 GMT
Find Nodes?
    Voting Booth?

    No recent polls found