If you want to run a quick Perl script without having to create & write in a file, you can run `perl` by itself and enter your code. End it with __END__ on its own line, or Ctrl-D, and then it will run what you've input.
I prefer ending with __END__ because then you can copy/paste the code and its output and see easily where the code ends and the output begins.
[kirsle@damocles ~]$ perl
print "Hello world!\n";
use Digest::MD5 qw(md5_hex);
for (1..5) {
print "$_ => " . md5_hex($_) . "\n";
}
__END__
Hello world!
1 => c4ca4238a0b923820dcc509a6f75849b
2 => c81e728d9d4c2f636f067f89cc14862c
3 => eccbc87e4b5ce2fe28308fd9f2a7baf3
4 => a87ff679a2f3e71d9181a67b7542122c
5 => e4da3b7fbbce2345d7772b0674a318d5
[kirsle@damocles ~]$
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.