|
-> , >= and => in Perl
Yes, Perl is eclectic - lots of things it can do, taken from lots of places and so, yes, it does have all three of those operators!
-> Run the method named to the right on the object named on the left
>= Return 1 (a true value) if the expression to the left is numerically greater than the expression to the right
=> Normally used to indicate a key, value pair for entry into a hash. In fact, the => operator is the equivalent of a , (a comma) which can be used instead - the=> is just provided to make the your code easier to read, and (in some circumstances) saves you the need to quote keys.
Examples:
$kgs = $current->getweight();
# Get the weight of the $current object
print "heavy\n" if ($kgs >= 100);
# Print out if $kgs is numerically 100 or greater
%info = (weight => 120, height => 1850);
# Set a hash with 2 key, value pairs (written 2006-11-18 10:44:05)
Associated topics are indexed under P104 - Perl - Conditional CodeP211 - Perl - HashesP218 - Perl - More Objects
Some other Articles
Clustering, load balancing, mod_rewrite and mod_proxyCourse Joining package - updatedA tale of a wee wallBefore and After - Well House Manor-> , >= and => in PerlPresenting Melksham - for a weekend away in WiltshireC++ and Perl - why did they do it THAT way?Hotel door furnitureTraining rooms to learn Open Source programmingC++ - just beyond the basics. More you can do
|
2259 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46 at 50 posts per page
This is a page archived from The Horse's Mouth at
http://www.wellho.net/horse/ -
the diary and writings of Graham Ellis.
Every attempt was made to provide current information at the time the
page was written, but things do move forward in our business - new software
releases, price changes, new techniques. Please check back via
our main site for current courses,
prices, versions, etc - any mention of a price in "The Horse's Mouth"
cannot be taken as an offer to supply at that price.
Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).
|
|