Harry Putnam wrote:
Shawn H Corey <shawnhco...@gmail.com> writes:
Harry Putnam wrote:
What I'm working on will eventually be a script that reads an `events'
file and lets me know about events I've entered there. It's my own
primitive but hopefully effective calendar reminder type of tool.
The format of entries look like this:
cat ~/.events
ev 100411 4
Wash behind ears
ev
ev 100421 4
Avoid a beating by taking out the garbage
this evening.
ev
[...]
The multidigit numbers represents YYMMDD,
if( my ( $year, $mnth, $mday, $extra ) = $line =~ m{ \A \s* ev \s*
(\d\d)(\d\d)(\d\d) \s* (\d+) \s* \Z }msx ){
# process event
}else{
# do something else
}
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 ) {
--
Just my 0.00000002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about coding.
I like Perl; it's the only language where you can bless your
thingy.
Eliminate software piracy: use only FLOSS.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/