>>>>> "HP" == Harry Putnam <rea...@newsguy.com> writes:
HP> Shawn H Corey <shawnhco...@gmail.com> writes: HP> [...] >>> Yikes, I'll be a week with perlre to get even close to following that. >>> In fact I don't really understand whats happening there at all. >>> >>> Also it doesn't appear to work with the data I posted unless the >>> $extra is present, and that is supposed to be up to the ~/.events >>> author. >> >> Oops, you're right. I forgot the extra was optional. Try: >> >> if ( my ( $year, $mnth, $mday, $extra ) = $_ =~ m{ \A \s* ev \s* >> (\d\d)(\d\d)(\d\d) \s* (\d+)? \s* \Z }msx ) { >> HP> Wow, gets it in one swoop. This construct looks pretty foreign to me. HP> I associate seeing =~ operator with s/// type setup. =~ is called the bind operator and it works with s///, m// and also tr///. you can find all info about operators in .... perldoc perlop! a critical thing to learn with perl is where to find things in the docs. perldoc perl lists all the docs and groups them to make it easier to find things. if you have the docs locally installed you can grep for things which is a great little search tool. perldoc.perl.org has all the docs in nice html with a search function too. as i tell all perl students, read/skim the core perl docs. do it again. you don't need to get everything but it helps to know what kinds of things are covered and where. the docs are perl's primary reference and you should look to them first to learn stuff. come here when/if you don't get something. HP> Can you steer me to a bit of documentation that explains what I'm HP> seeing here. Particularly m{...}msx m// is the same as // but m allows for alternate delimiters which are useful when you have / in the regex itself. otherwise you get leaning toothpick syndrome which is hard to read as you need \/ to get a single / in there. the suffixes msx are documented in perlre, and perlretut and perlrequick are a tutorial and quick reference to regexes. i would read these last too asap to learn more about them. uri -- Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/