in reply to How to return value of a variable from shell script to perl script

Welcome to the Monastery, babp. You might get better feedback if you format your question a little bit more readable. Please see Markup in the Monastery (esp. <code>). (Un-)fortunately, the HTML source of this page is more readable, so let me repeat the basic parts of your question:

Perl program:
my $diff1 = system("sh diff.sh"); my $diff2 = system("sh diff1.sh");
diff.sh:
a=diff aaa ccc
diff1.sh:
b=diff aaa bbb

The problem is, that diff.sh and diff1.sh don't do what you (probably) had in mind: The variable (a or b) is set to the string diff, then the shell tries to execute(!) aaa with argument bbb or ccc.

Suggestion (non-Perl): Correct diff.sh (analogue diff1.sh), e.g.

diff aaa bbb a=$? # do something else with $a exit $a

Which can be reduced to...

diff aaa bbb
... in case you only want to execute diff. The shell (usually) returns the exec state of the last statement executed. BTW: Perl has borrowed this idea here and there (e.g. return) - although this is not best practice.

But then, wouldn't it be easier to avoid the *.sh wrappers and put that into the Perl script too?

my $diff1 = system("diff aaa ccc >/dev/null 2>&1"); my $diff2 = system("diff aaa bbb >/dev/null 2>&1");
Note the redirections to get rid of diff's output. If your version of diff supports a switch to suppress output and just return the exec state, then give the system LIST variant a try for better security.
Please be aware that $diff1 and $diff2 contain 0 on success but not necessarily 1 on error since catched signals are encoded into the return value (details in system).

Finally, CPAN offers a lot of modules when searching for diff. Might be worth a check...

HTH