Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Yes, this code is extremely inefficient. If you hand it in for homework, your teach will laugh at you. However, if you're having trouble with the Caesar Cipher, it might help you.
#!/usr/bin/perl $line = "I'z abg fnlvat lbh nfxrq n ubzrjbex dhrfgvba..."; for ($i = 0; $i < length $line ; $i++) { $char = substr $line, $i, 1; if ($char eq "a") { $char = "n"; } elsif ($char eq "b") { $char = "o"; } elsif ($char eq "c") { $char = "p"; } elsif ($char eq "d") { $char = "q"; } elsif ($char eq "e") { $char = "r"; } elsif ($char eq "f") { $char = "s"; } elsif ($char eq "g") { $char = "t"; } elsif ($char eq "h") { $char = "u"; } elsif ($char eq "i") { $char = "v"; } elsif ($char eq "j") { $char = "w"; } elsif ($char eq "k") { $char = "x"; } elsif ($char eq "l") { $char = "y"; } elsif ($char eq "m") { $char = "z"; } elsif ($char eq "n") { $char = "a"; } elsif ($char eq "o") { $char = "b"; } elsif ($char eq "p") { $char = "c"; } elsif ($char eq "q") { $char = "d"; } elsif ($char eq "r") { $char = "e"; } elsif ($char eq "s") { $char = "f"; } elsif ($char eq "t") { $char = "g"; } elsif ($char eq "u") { $char = "h"; } elsif ($char eq "v") { $char = "i"; } elsif ($char eq "w") { $char = "j"; } elsif ($char eq "x") { $char = "k"; } elsif ($char eq "y") { $char = "l"; } elsif ($char eq "z") { $char = "m"; } $decoded .= $char; } print $decoded, "\n";

In reply to Re: encryption by blogan
in thread encryption by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-25 14:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found