[28102] in Perl-Users-Digest
Perl-Users Digest, Issue: 9466 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 13 21:05:42 2006
Date: Thu, 13 Jul 2006 18:05:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 13 Jul 2006 Volume: 10 Number: 9466
Today's topics:
Re: Cool Ebooks Site (Randal L. Schwartz)
Re: Cool Ebooks Site <sigzero@gmail.com>
Re: finding perl info on google can be hard <David.Squire@no.spam.from.here.au>
Re: problem with time stamp <someone@example.com>
Re: some help again with if statement <1usa@llenroc.ude.invalid>
Re: some help again with if statement <1usa@llenroc.ude.invalid>
Re: some help again with if statement <tadmc@augustmail.com>
Re: some help again with if statement <starfrit@gmail.com>
Re: some help again with if statement <jgibson@mail.arc.nasa.gov>
Re: some help again with if statement <tadmc@augustmail.com>
Re: some help again with if statement <jurgenex@hotmail.com>
Re: Traverse a directory <rvtol+news@isolution.nl>
Re: Traverse a directory <tadmc@augustmail.com>
Re: Traverse a directory <DJStunks@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 13 Jul 2006 16:18:32 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Cool Ebooks Site
Message-Id: <86r70pw0tz.fsf@blue.stonehenge.com>
>>>>> "bigskipster" == bigskipster <bigskipster@gmail.com> writes:
bigskipster> http://XXXXXXXXXXXXXXXX.blogspot.com
bigskipster> Submit your comments because I need them!
Reported to infringement@oreilly.com. If someone wants to take
on getting this idiot booted from his ISP, please do.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
--
Posted via a free Usenet account from http://www.teranews.com
------------------------------
Date: 13 Jul 2006 17:51:59 -0700
From: "Robert Hicks" <sigzero@gmail.com>
Subject: Re: Cool Ebooks Site
Message-Id: <1152838319.764815.311130@s13g2000cwa.googlegroups.com>
bigskipster@gmail.com wrote:
> http://cooldogebooks.blogspot.com
>
>
> Submit your comments because I need them!
>
My comment would be that you need some ethics training.
Robert
------------------------------
Date: Thu, 13 Jul 2006 23:15:36 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: finding perl info on google can be hard
Message-Id: <e96gm8$qr1$1@gemini.csx.cam.ac.uk>
ilikesluts@gmail.com wrote:
> Hi Jürgen Exner,
>
> LOL! You must have a bad short term memory :)
> If you look at my first post you'll see the answer.
>
> Jürgen Exner wrote:
>> ilikesluts@gmail.com wrote:
>> Ok, well, fine, whatever.
>> In which way are the limitation or non-limitations of Google related to
>> Perl?
Either you really don't get it, or you are a very effective troll. You
need to adjust your sarcasm detectors.
Also, consider this question:
I can't see the moon through my glasses. Is this a problem with my
glasses or the moon?
DS
------------------------------
Date: Thu, 13 Jul 2006 22:05:49 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: problem with time stamp
Message-Id: <1tztg.49466$B91.6956@edtnps82>
davide.papagno@gmail.com wrote:
>
> I use this command to get the time stamp file output
>
> $date = ctime(stat($file)->mtime);
According to my ctime(3) man page: "The call ctime(t) is equivalent to
asctime(localtime(t))." and in perl localtime() in scalar context is the same
as C's asctime(localtime(t)) so you don't really need ctime there:
$date = localtime stat( $file )->mtime;
> and what I get is:
>
> Wed Apr 5 16:44:43 2006
>
> is there a simple way to get only
>
> Wed Apr 5
$date = substr localtime stat( $file )->mtime, 0, 10;
John
--
use Perl;
program
fulfillment
------------------------------
Date: Thu, 13 Jul 2006 22:19:13 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: some help again with if statement
Message-Id: <Xns97FFBA763A72Fasu1cornelledu@127.0.0.1>
"starfrit" <starfrit@gmail.com> wrote in news:1152827244.881640.234240
@i42g2000cwa.googlegroups.com:
[ Quote some context when replying. For proper quoting style, see the
posting guidelines for this group ]
> Like I said, I'm trying to adapt a script made for the community.
How is that relevant?
> I tried many variations and I did not kept copy of my attemps.
I will refer you to items #11900, #11901, #11905, #11917, #11924, #
11926, #11927, #11930, #11941, #11942, and #11957 in
http://groups.google.com/group/comp.lang.perl.misc/msg/b2f911d6d9c5cef2
> Other that that, I'm not sure what you're asking for.
Reading the posting guidelines would have helped you.
> But juste to make sure, if i'm right
As I mentioned, see item #11905.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Thu, 13 Jul 2006 22:31:28 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: some help again with if statement
Message-Id: <Xns97FFBC894D84Casu1cornelledu@127.0.0.1>
"starfrit" <starfrit@gmail.com> wrote in news:1152825484.021143.326510
@m73g2000cwd.googlegroups.com:
> I need some help again converting an old script with a new structure
>
> Before, I had this line with this IF
> 1. WASHINGTON, SVATOS 3 (EXELBY, JOHNSON), 03:52<BR>
> if (m/^\d+.\s*(\w*.*)\,.\s*(\w*.*)\s+(\d+).\(.*\)\,.*/)
Please post real Perl code that others can copy, paste, and run easily.
Please do read the posting guidelines for this group to learn how you
can help yourself and help others help you.
#!/usr/bin/perl
use strict;
use warnings;
my $s = q{1. WASHINGTON, SVATOS 3 (EXELBY, JOHNSON), 03:52<BR>};
if ( my @matches
= ( $s =~ /^\d+.\s*(\w*.*)\,.\s*(\w*.*)\s+(\d+).\(.*\)\,.*/ )
) {
local $" = "\n";
print "@matches\n";
}
__END__
...
> Now, the same line is written like this
> 1. Washington Capitals , Marek Svatos 3 (Garnet Exelby, Mike Johnson)
> at 3:52<br />
Now, you can try to come up with our own solution, and ask for help,
following the guidelines, when you need it.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Thu, 13 Jul 2006 17:26:14 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: some help again with if statement
Message-Id: <slrnebdi46.m2a.tadmc@magna.augustmail.com>
starfrit <starfrit@gmail.com> wrote:
> No, that's not my intention,
What is not your intention?
Please quote some context in followups like everybody else does.
> I tried many
> variations and I did not kept copy of my attemps. Other that that, I'm
> not sure what you're asking for.
He was asking to see some of your attempts!
If you don't have them anymore, then make one more attempt and post that.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 13 Jul 2006 15:36:57 -0700
From: "starfrit" <starfrit@gmail.com>
Subject: Re: some help again with if statement
Message-Id: <1152830217.338900.87930@35g2000cwc.googlegroups.com>
First, you don't have to be so rude, your little points are very
agressive, and second, I'm a professional IT, not a newb. I just
didn't do much programming for the last years, and my Perl is very
rusty because I learned that in school a few years ago.
As for my problem, here's the code of the ciomplete function. What it
does is browse through an html file which id a boxscore. What I need
to do with this code is find the line in the html which are goals
scored, and output them in another html file like this : SVATOS 3,
JOHNSON 15, LILES 1
# Team section
# <H1>Rangers at Vancouver</H1>
if (m/<h1>\s*(\w*.*) vs \s*(\w*.*)/)
{
$AWAY = uc($1);
$AW_ABREV = uc($abrev{$AWAY});
$HOME = uc($2);
$HM_ABREV = uc($abrev{$HOME});
#print "-=> $AWAY,";
#print "-=> $HOME,";
}
# Goal section
#old 1. WASHINGTON, SVATOS 3 (EXELBY, JOHNSON), 03:52<BR>
#new 1. Washington Capitals , Marek Svatos 3 (Garnet Exelby, Mike
Johnson) at 3:52<br />
if (m/^\d+.\s*(\w*.*)\,.\s*(\w*.*)\s+(\d+).\(.*\)\,.*/){
print "-=> $1,";
if ($1 eq $AWAY) {
if (defined($sc_away{$2}))
{
$sc_away{$2} .= ",$3";
}
else
{$sc_away{$2} .= "$3";}
$goal_a++;
}
else
{
if (defined($sc_home{$2})){ $sc_home{$2} .= ",$3";}
else {$sc_home{$2} .= "$3";}
$goal_h++;
}
}
------------------------------
Date: Thu, 13 Jul 2006 15:53:10 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: some help again with if statement
Message-Id: <130720061553102422%jgibson@mail.arc.nasa.gov>
In article <1152827244.881640.234240@i42g2000cwa.googlegroups.com>,
starfrit <starfrit@gmail.com> wrote:
> No, that's not my intention, but i'm not by far an expert in Perl, I
> can safely browse the code and now where I'm at though. Like I said,
> I'm trying to adapt a script made for the community. I tried many
> variations and I did not kept copy of my attemps. Other that that, I'm
> not sure what you're asking for.
Paul is asking that you post a minimal program that shows what is your
best attempt at solving the problem. Also, please quote the context to
which you are responding so that others will know what is going on.
>
> But juste to make sure, if i'm right
> \d+. is for the 1.
Period matches any character except newline. You need to escape it to
match a literal period (\d+\.).
> \s* is for the first space
> (\w*.*) is a Wildcard for WASHINGTON
Period matches any character, so this will match the entire remaining
string.
> \,. is the ,
Commas are not special, so need not be quoted.
> \s* is another space
> (\w*.*) is a wildcard for SVATOS
This will also match the entire remaining string.
> \s+ another space
> (\d+).\(.*\)\,.* is for the rest of the line, which is irrelevant for
> the output I want to make
>
To avoid further irritating the regulars and because I was bored:
#!/usr/local/bin/perl
#
use strict;
use warnings;
my $s = q(1. Washington Capitals , Marek Svatos 3 (Garnet Exelby, Mike
Johnson));
if( $s =~ m{
^ # start of line
\d+ # number
\. # period (escaped)
\s* # optional whitespace before name
([\w ]+?) # name with embedded spaces, non-greedy -- captured
\s* # possible whitespace after name, greedy
, # separating comma
\s* # possible whitespace
\w+ # first name
\s+ # required whitespace
(\w+) # last name
\s+ # required whitespace
(\d+) # number
}ix
) {
print "<$_>\n" for $1, $2, $3;
}else{
print "No match!\n";
}
__OUTPUT__
<Washington Capitals>
<Svatos>
<3>
Note: this will only work if names match \w+, and will not if names
have dashes, periods, or apostrophes (e.g. Tim O'Leary, Jr.)
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: Thu, 13 Jul 2006 19:19:48 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: some help again with if statement
Message-Id: <slrnebdop4.mjp.tadmc@magna.augustmail.com>
starfrit <starfrit@gmail.com> wrote:
> First, you don't have to be so rude,
So long!
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 14 Jul 2006 00:30:08 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: some help again with if statement
Message-Id: <kABtg.8893$Zf.1086@trnddc04>
starfrit wrote:
> First, you don't have to be so rude, your little points are very
> agressive,
Who is "you"? What are you referring to?
Please quote appropriate context -as has been customary for 2 decades- such
that people have a chance to know what you are talking about.
> and second, I'm a professional IT, not a newb.
Oh, really? And you can't distinguish between a problem with an if statement
and a regular expression match?
Interesting.
So long
jue
------------------------------
Date: Thu, 13 Jul 2006 23:54:51 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Traverse a directory
Message-Id: <e96mhr.1f4.1@news.isolution.nl>
Paul Lalli schreef:
> weberw:
>> Also, can you explain this line?
>> if ( -d and !/^\.\.?$/ and !$skip_dir{$_}) {
>
> -d is covered in `perldoc -f -d`. Regular expressions are covered in
> `perldoc perlretut` (among others). Hashes are covered in `perldoc
> perldata`.
>
> This line says: "If $_ is a directory and if $_ is not either '.' or
> '..' and if $_ does not have a true value inside the %skip_dir hash,
> then ..."
<ignoring the Windows context>
I think that should be /\A\.\.?\z/, because $ can match before \n, and
qq/.\n/ and qq/..\n/ are possible names.
</ignoring>
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Thu, 13 Jul 2006 17:33:46 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Traverse a directory
Message-Id: <slrnebdiia.m2a.tadmc@magna.augustmail.com>
weberw@adelphia.net <weberw@adelphia.net> wrote:
> I want to print out a listing of folders and their contents with
> indentation. I don't want to print folder 3.
> Here is my code.
It is not your code.
If you had written it, then you would already know how to exclude
directories (in fact the code already excludes some directories).
> sub wanted {
>
>
> if (-d) {
> return unless /[^.]/;
That is a pretty obfuscated way to eliminate the . and .. directories.
return if /folder 3/;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 13 Jul 2006 16:02:30 -0700
From: "DJ Stunks" <DJStunks@gmail.com>
Subject: Re: Traverse a directory
Message-Id: <1152831750.814707.268840@p79g2000cwp.googlegroups.com>
Tad McClellan wrote:
> weberw@adelphia.net <weberw@adelphia.net> wrote:
> > return unless /[^.]/;
>
> That is a pretty obfuscated way to eliminate the . and .. directories.
lol
stir the pot, Tad
:p
-jp
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 9466
***************************************