1

I have tried the following:

:let @0 = system('perl /home/hermann/hi.pl')
:echo @0

Having hi.pl like this:

\#!/usr/bin/perl
exit(34);

But I dont get 34 into @0, I get nothing.

How do I return a value from a perl script to a vimscript?

1 Answer 1

4

Firstly, :echo @0v is just a typo that should be :echo @0, right?

Secondly, system() in vimscript returns the standard output of the command not the command's return value. Your let @0 ... is equivalent to one of these in perl:

my $x = `perl /home/hermann/hi.pl`;
my $y = qx:perl /home/hermann/hi.pl:;

If you want the return value rather than the command's standard output, look at the v:shell_error variable.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.