After reading all of these helpful replies, I decided to try out a subroutine and attempt to better understand the syntax by adding comment:
#! /usr/bin/perl -w
sub of_all_things {
print "You called me!\n"; #will print this when called
$one*$two; #Here are the workings that will return value
}
$one = 12;
$two = 10;
$three=&of_all_things; #return value
$four=2*$three; #using the return value
print "2 x 120 = $four\n";
OUTPUT:
You called me!
2 x 120 = 240
This seems to work out on my box, but I am most concerned as to whether my comments are aiming at in the right direction?
Es gibt mehr im Leben als Bücher, weißt du. Aber nicht viel mehr. - (Die Smiths)"
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.