Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: How can one use the print function to get the correct information?

by golux (Hermit)
on Apr 05, 2013 at 18:08 UTC ( #1027188=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1027188]
help
Chatterbox?
[Corion]: ambrus: He isn't familiar with GIGO (or nIGO) yet?
[Corion]: Also, is it impossible in the general case, but doable in your specific case, maybe? I find that working through a counterexample usually makes people see the light
[Corion]: Uiiih! Let's Encrypt will start issuing wildcard certificates, that's cool!
[ambrus]: Corion: no, backwards. It's possible in the general case, but not in the specific case of bad data we have. Which is why it's harder to explain.
[marto]: that reminds me, to donate...
[ambrus]: If it was possible in this specific case, then the burden to argue for that would be his.

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (9)
As of 2017-12-12 13:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (332 votes). Check out past polls.

    Notices?