Adam -- ...and then Adam Vardy said... % % Can someone help please. I'm learning from scratch. What is this?
I can try... % % $_='My email address is <[EMAIL PROTECTED]>.'; This is an assignment statement (see, there is another command!). It sets the $_ variable, which is the standard "what we're working with at the moment" variable and which usually gets set for you by other operations, to the string in the ''s. % % /(<.*>)/i; This (the // part) searches $_ ('cuz it's that with which we expect we're working) for a < and then zero or more of anything and then a > and it ignores (the trailing i) case in the search. As part of the operation of the search, it sets $1 to whatever it matched, which is everything in $_ that is or is between two <>s (hey, that email address up there). % % print "Found it ! $1\n"; This prints a constant string ("Found it !") and then the aforementioned results of the search string and then a newliine ("\n"). % % I can only identify one command here. Print. How does this 'program' % run? It's very trivial, though somewhat less so than that good old favorite print "hello, world!\n"; which has been convoluted terribly along the way, and you could stick these commands into a file and then run perl /tmp/p against it or such; the commands need to be fed through the perl interpreter. Of course, it's wisest to turn on strict checking ("use strict;") and warnings ("perl -w" or, as you prefer, something like "use warnings" on which I'm unsure) and most useful to write code that actually does something, but who says every script has to pull its own weight? :-) % % % -- % Adam V. HTH & HAND :-D -- David T-G * It's easier to fight for one's principles (play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie (work) [EMAIL PROTECTED] http://www.justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
msg25433/pgp00000.pgp
Description: PGP signature