http://www.perlmonks.org?node_id=1027188


in reply to How can one use the print function to get the correct information?

Hi supriyoch_2008,

It looks like you want to return a string of text from your "display()" function (and then maybe you should call it something besides "display"). For example:

sub display { my ($self) = @_; if ($self) { my $text = " Student Name: $self->{NAME}\n"; $text .= " Age (yr): $self->{AGE}\n"; $text .= " Regd no: $self->{REGD_NO}\n"; return $text; } else { return "Not found"; } }

As it is, you're just returning the last thing, which is the value of the print statement (TRUE if successful).

say  substr+lc crypt(qw $i3 SI$),4,5
  • Comment on Re: How can one use the print function to get the correct information?
  • Download Code