in reply to Re: diff vs diff -y
in thread diff vs diff -y

Thank you @roboticus, wow algorithm::diff definitely new to me, and it seems pretty effective!

That's a lot for me to learn in this code ! It's definitely useful as a newbie like me !

I love Perl more now !

I would like to know why is readfile sub is used for ?

Why can't just use declaration in below?
my $LFName = shift // die "Expected two file names!"; my @lfile = readfile($LFName); my $RFName = shift // die "Expected *TWO* file names!"; my @rfile = readfile($RFName);
Since it's receiving input this way, I would like to ask,

what is it's for remote files in remote server ?

Will it be any difference ? Still using the same to readfile() ?

Replies are listed 'Best First'.
Re^3: diff vs diff -y
by roboticus (Chancellor) on Oct 22, 2018 at 23:25 UTC

    MisPerl:

    The readfile subroutine has two purposes: First it abstracts away the fetching of the data that we'll compare with Algorithm::Diff, and secondly to reduce (even if only a little) code duplication.

    By replacing the readfile() routine, you can source the data from wherever you like, without impacting the diff table generator. The way it's currently written, it'll just read whatever file you specify on the local machine. But you can rewrite readfile() to fetch from a remote server or whatever you may like. The only thing readfile() needs to return is the data you want to take the difference of.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.