James Teare
James Teare

Reputation: 372

Returning strings in PERL

I am trying to get SOAP to return a message, at the moment it just returns hello world.

package RAM;
sub ram {
#!/usr/bin/perl
use Sys::MemInfo qw(totalmem freemem totalswap);

return SOAP::Data->name('result')->type('string')->value("hello world");
}
1;

I am trying to get SOAP to return:

print "free memory:  ".(&freemem / 1024)."\n";

instead of "hello world"

Any help would be appreciated :)

Upvotes: 0

Views: 292

Answers (1)

Bruce
Bruce

Reputation: 1542

How about....

  my $string_to_return = "free memory: ".(&freemem / 1024)."\n";
  return SOAP::Data->name('result')->type('string')->value($string_to_return);

Upvotes: 1

Related Questions