On Sep 26, [EMAIL PROTECTED] said:

>#!/usr/bin/perl
>#return a value wrapped by single quotes
>#should this be declare package something?
>sub doWrap
>{ my $retval;
>
>  if(length($_[0]) == 0) { $retval = "null"; }
>  else { $retval = "'" . $_[0] . "'"; }
>}

You need to RETURN $retval.  It's always a wise idea to explicitly state
the return value of a function.

And your file should end in 1;, so that Perl knows the file works right.

  sub doWrap {
    # ...
    return $retval;
  }

  1;

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to