in reply to Re^3: Comparing an array against another array
in thread Comparing an array against another array
I am using List::Compare, seemed like a good way to compare these two arrays. My comparing method doesn't seem to be producing the result it should be, though.. Would it be because doing ls -a stores each item on a new line? To clarify, here is the code:
#!/usr/bin/perl use List::Compare; my $hostname = $ARGV[0]; my @hostFiles = qw/filecheck.pl hostscript.pl awesomeness.txt/; my @output =`ssh $hostname "cd Desktop; ls -a"`; $lc = List::Compare->new(\@hostFiles, \@output); @Lonly = $lc->get_unique; print @Lonly;
And this is what prints out
Password: awesomeness.txt filecheck.pl hostscript.pl
So then I printed out what's on my desktop along with whatever @Lonly is saving as:
awesomeness.txt filecheck.pl hostscript.pl . .. .DS_Store .localized PERL TESTS compare.pl greptest.pl hostfilecheck.pl hostscript.pl
Why would @Loutput still be showing hostscript.pl if that's on the Desktop?
|
|---|