Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Personal crypting algorithm

by premchai21 (Curate)
on Nov 05, 2001 at 22:39 UTC ( #123381=note: print w/ replies, xml ) Need Help??


in reply to Personal crypting algorithm

Don't print the results. Returning them instead is a much better idea. What if the caller doesn't want the encrypted / decrypted string printed, but instead wants to do something else with it? Sure, they could do something obfuscated like tie STDOUT so its output goes into a variable, but the idea here (assuming this is not for obfuscation) is to not require the caller to do things like that.


Comment on Re: Personal crypting algorithm
Re: Re: Personal crypting algorithm
by Asmo (Monk) on Nov 05, 2001 at 22:59 UTC
    well; then you just have to change print $result; with $_ = $result; I suppose... But i don't know how the $_ variable is handled with packages (yeah it's my first one) so, if you could tell me if it's the right way to re use the encrypted string...

    thx

    Asmo
      Er... no. return $result; Then, caller could do (after importing the functions) $ciphertext = acrypt($plaintext, $key); (or similarly for adecrypt). See perlvar, perlmod, perlsub.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://123381]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2014-07-31 03:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (244 votes), past polls