[31826] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3089 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 20 21:09:24 2010

Date: Fri, 20 Aug 2010 18:09:09 -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           Fri, 20 Aug 2010     Volume: 11 Number: 3089

Today's topics:
    Re: FAQ 3.4 How do I find which modules are installed o <brian.d.foy@gmail.com>
    Re: FAQ 5.23 AND: Perl the latest vs Perl the gratest <brian.d.foy@gmail.com>
    Re: FAQ 5.23 AND: Perl the latest vs Perl the gratest <brian.d.foy@gmail.com>
        Fast iterative reads <paulbranon@googlemail.com>
    Re: Fast iterative reads <ben@morrow.me.uk>
    Re: Fast iterative reads <jimsgibson@gmail.com>
    Re: Fast iterative reads sln@netherlands.com
    Re: Multiple regex operations <derykus@gmail.com>
    Re: parsing CSV files <jwkrahn@example.com>
    Re: Perl array bug? <ben@morrow.me.uk>
    Re: Perl array bug? (Malcolm Hoar)
    Re: Perldoc: integers *stored* as... ??? <nospam-abuse@ilyaz.org>
        regular expression for beow text <hara.acharya@gmail.com>
    Re: regular expression for beow text sln@netherlands.com
    Re: regular expression for beow text <jimsgibson@gmail.com>
    Re: regular expression for beow text <sbryce@scottbryce.com>
    Re: regular expression for beow text <tadmc@seesig.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 20 Aug 2010 14:59:17 -0500
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 3.4 How do I find which modules are installed on my system?
Message-Id: <200820101459172096%brian.d.foy@gmail.com>

In article
<3bddb610-d23f-4090-9a93-c36fe0829a99@x20g2000pro.googlegroups.com>,
Owen <xemoth@gmail.com> wrote:


> > 3.4: How do I find which modules are installed on my system?
> >
> >     From the command line, you can use the "cpan" command's "-l" switch:
> >
> >             $ cpan -l

> Well just tried this and "it didn't work".

Which version of Perl do you have? If it's not something released in
the last two years, expect the current FAQ to have more cool things
than your ancient installation has. 

There are several alternate methods in the FAQ that do let you still
accomplish this task with ancient Perls though. :)


------------------------------

Date: Fri, 20 Aug 2010 14:54:27 -0500
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 5.23 AND: Perl the latest vs Perl the gratest
Message-Id: <200820101454274692%brian.d.foy@gmail.com>

In article <oifuj7-54l.ln1@osiris.mauzo.dyndns.org>, Ben Morrow
<ben@morrow.me.uk> wrote:


> > I'm really puzzled.  It looks like you consider my remark rude.  How
> > comes?  I'm really listening...
> 
> Maybe I'm being over-sensitive. '...the current state of Perl docs is
> abysmal' reads to me like a condemnation of p5p, for not having fixed
> them yet. The docs aren't 'abysmal', they're simply not as good as they
> might be. 

I'd say that they are pretty abysmal and hard to use. They are a giant
all of mud that has accreted with no plan or forethought for 15 years,
and often the file in which something lives makes no sense. For
instance, why is my and local in perlsub?

As isolated islands of content, the stuff in the files are generally
good once you discover them. As a whole, everything is a mess.
Searching is sometimes useless since many of the interesting keywords
are also common words.


------------------------------

Date: Fri, 20 Aug 2010 14:59:22 -0500
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 5.23 AND: Perl the latest vs Perl the gratest
Message-Id: <200820101459222379%brian.d.foy@gmail.com>

In article <87y6c4dose.fsf@lifelogs.com>, Ted Zlatanov
<tzz@lifelogs.com> wrote:

> On Tue, 17 Aug 2010 22:59:50 -0500 "Mumia W."
> <paduille.4061.mumia.w+nospam@earthlink.net> wrote: 
> 
> MW> My 2¢ is that the FAQ is better as a cookbook. A power-user's personal
> MW> blog would be the best way to showcase the latest and greatest
> MW> features (including best practices with Perl's later than 5.8.8).
> 
> Sorry, but I must disagree.  Personal blogs are not a reliable resource
> or packaged with Perl and thus have nowhere near the power and presence
> of the FAQ.

Everyone can go back and forth all they like about what should and
shouldn't be in the FAQ. What it really comes down to is the people who
submit patches. Since that's basically me, that means I get to decide.
:)

That doesn't mean other people don't get to decide, but I don't see the
point in arguing something at length if you don't have the time to
submit a patch. It's incredibly easy with Github since you don't even
need to know that much about git: just do it all on the website.


------------------------------

Date: Fri, 20 Aug 2010 13:16:47 -0700 (PDT)
From: Paul Branon <paulbranon@googlemail.com>
Subject: Fast iterative reads
Message-Id: <8195b32f-7720-4aaf-b6a1-40d1931e6429@i13g2000yqd.googlegroups.com>

Hypothetically speaking: -


Say I have a file containing 100,000 numbers, and each number
corresponds to a database id

and I have another file which contains all of the database ids plus
the name of the file that corresponds to it.
(Why couldn't I do an sql query which puts all the info in one file?
Because I don't have access to the database!)
So, I have these two files! (The second file is much larger than the
first, say 300,000 records or more)
  Now, the only way that I can match database ids to filenames is to
traverse list one and for each entry in list one then iteratively
traverse list two until a match is made
(In shell you would just use grep) what I'm doing is while <FILENAME>{
 
if ( $number =~ /\b$othernumber\b/){
 
carryoutmatch_behaviour;
                                                                              }
                                                                          }

It works. But it's relatively slow! (perhaps not surprisingly!)


Question) How would you solve the problem? (More quickly)












------------------------------

Date: Fri, 20 Aug 2010 21:31:51 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Fast iterative reads
Message-Id: <na53k7-e6r1.ln1@osiris.mauzo.dyndns.org>


Quoth Paul Branon <paulbranon@googlemail.com>:
> Hypothetically speaking: -
> 
> 
> Say I have a file containing 100,000 numbers, and each number
> corresponds to a database id
> 
> and I have another file which contains all of the database ids plus
> the name of the file that corresponds to it.
> (Why couldn't I do an sql query which puts all the info in one file?
> Because I don't have access to the database!)
> So, I have these two files! (The second file is much larger than the
> first, say 300,000 records or more)
>   Now, the only way that I can match database ids to filenames is to
> traverse list one and for each entry in list one then iteratively
> traverse list two until a match is made
> (In shell you would just use grep) what I'm doing is while <FILENAME>{
>  
> if ( $number =~ /\b$othernumber\b/){
>  
> carryoutmatch_behaviour;
> 
> It works. But it's relatively slow! (perhaps not surprisingly!)
> 
> Question) How would you solve the problem? (More quickly)

Use a hash. Read the second file into a hash mapping id to filename,
then you can quickly look up the filename when you iterate over the
first file. If you run out of memory (not likely with only 300_000
records) look into one of the DBM_File modules.

Ben




------------------------------

Date: Fri, 20 Aug 2010 15:09:10 -0700
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: Fast iterative reads
Message-Id: <200820101509102311%jimsgibson@gmail.com>

In article <na53k7-e6r1.ln1@osiris.mauzo.dyndns.org>, Ben Morrow
<ben@morrow.me.uk> wrote:

> Quoth Paul Branon <paulbranon@googlemail.com>:
> > Hypothetically speaking: -
> > 
> > 
> > Say I have a file containing 100,000 numbers, and each number
> > corresponds to a database id
> > 
> > and I have another file which contains all of the database ids plus
> > the name of the file that corresponds to it.
> > (Why couldn't I do an sql query which puts all the info in one file?
> > Because I don't have access to the database!)
> > So, I have these two files! (The second file is much larger than the
> > first, say 300,000 records or more)
> >   Now, the only way that I can match database ids to filenames is to
> > traverse list one and for each entry in list one then iteratively
> > traverse list two until a match is made
> > (In shell you would just use grep) what I'm doing is while <FILENAME>{
> >  
> > if ( $number =~ /\b$othernumber\b/){
> >  
> > carryoutmatch_behaviour;
> > 
> > It works. But it's relatively slow! (perhaps not surprisingly!)
> > 
> > Question) How would you solve the problem? (More quickly)
> 
> Use a hash. Read the second file into a hash mapping id to filename,
> then you can quickly look up the filename when you iterate over the
> first file. If you run out of memory (not likely with only 300_000
> records) look into one of the DBM_File modules.

Alternatively, if you run out of memory, sort the two files by ID.
Then, read a line from file one and start reading lines from file two.
If the ID from file 2 is the same as the ID from file 1, use the line
and read the next line from file 1. If the ID is less, discard it and
read the next line from file 2. If the ID is greater, the ID doesn't
exist in file 2, so skip it and read the next line from file 1.

-- 
Jim Gibson


------------------------------

Date: Fri, 20 Aug 2010 15:28:18 -0700
From: sln@netherlands.com
Subject: Re: Fast iterative reads
Message-Id: <1sut66teo86s824knupfnejkl567nfnc8u@4ax.com>

On Fri, 20 Aug 2010 13:16:47 -0700 (PDT), Paul Branon <paulbranon@googlemail.com> wrote:

>Hypothetically speaking: -
>
>
>Say I have a file containing 100,000 numbers, and each number
>corresponds to a database id
>
>and I have another file which contains all of the database ids plus
>the name of the file that corresponds to it.
>(Why couldn't I do an sql query which puts all the info in one file?
>Because I don't have access to the database!)
>So, I have these two files! (The second file is much larger than the
>first, say 300,000 records or more)
>  Now, the only way that I can match database ids to filenames is to
>traverse list one and for each entry in list one then iteratively
>traverse list two until a match is made
>(In shell you would just use grep) what I'm doing is while <FILENAME>{
> 
>if ( $number =~ /\b$othernumber\b/){
> 
>carryoutmatch_behaviour;
>                                                                              }
>                                                                          }
>
>It works. But it's relatively slow! (perhaps not surprisingly!)
>
>
>Question) How would you solve the problem? (More quickly)
>

Why would you need file-1? Do you need to keep track of the 100,000
numbers? I don't see why.

File-2 looks to be 2 fields because its 300,000 records,
with multiple filenames per id.
But, it doesn't matter.
And it doesn't matter with only 300,000 records as far as
memory, otherwise a in-file lookup of indexed positions
might be more efficient.

Track it all:

while (<file1>)
{
   ($control, $id) = parse1 ($_);
   $dbhash{$id}->[0] = $control if !exists ($dbhash{$id});
}
while (<file2>)
{
   ($id, @filenames) = parse2 ($_);
   push @{$dbhash{$id}}, @filenames if exists ($dbhash{$id});
}
for $testid ( '123', '653' ) {
    if (exists $dbhash{$testid}) {
       ($control, @filenames) =  @{$dbhash{$testid}};
       print "id: $testid, control: $control\n";
       for (@filenames) {
           print " $_\n";
       }
}

-sln


------------------------------

Date: Fri, 20 Aug 2010 14:05:24 -0700 (PDT)
From: "C.DeRykus" <derykus@gmail.com>
Subject: Re: Multiple regex operations
Message-Id: <bd25c923-5558-4fbf-a6be-bf34c3f49d13@m17g2000prl.googlegroups.com>

On Aug 19, 9:40=A0pm, Orion M=EDmamei=F0r <zacharyellio...@gmail.com> wrote=
:
> Is there a way to apple multiple regex operations to a single string
> without writing them all out?
>
> example.
>
> suppose I have some variable $var and want it apple three regexs to
> it. is there a faster way than
>
> $var =3D~ s/foo/bar/;
> $var =3D~ s/foo/bar/;
> $var =3D~ s/foo/bar/;


$var =3D~ s/foo/bar/ for 1..3;

--
Charles DeRykus


------------------------------

Date: Fri, 20 Aug 2010 13:06:52 -0700
From: "John W. Krahn" <jwkrahn@example.com>
Subject: Re: parsing CSV files
Message-Id: <yfBbo.58644$f_3.42739@newsfe17.iad>

monkeys paw wrote:
> FILE contains:
> US,S,2009,Alexander L,R,"AGRICULTURE, NUTRITION AND FORESTRY."
> US,S,2009,Alexander L,R,ARMED SERVICES.
>
> If i parse the above lines with a split /,/ i will
> correctly get field[5] = "ARMED SERVICES" on line 2,
> but incorrectly field[5] = "AGRICULTURE," on line 1.
>
> while ($line = <IN>) {
> @field = split /,/, $line;
> print "$field[5]\n";
> }
>
> Is there a way to modify the split to handle this file format?

If $field[5] is the only field with this problem then:

while ( my $line = <IN> ) {
     my @field = split /,/, $line, 6;
     print "$field[5]\n";
}



John
-- 
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.                   -- Albert Einstein


------------------------------

Date: Fri, 20 Aug 2010 19:19:18 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Perl array bug?
Message-Id: <6it2k7-v5q1.ln1@osiris.mauzo.dyndns.org>


Quoth malch@malch.com (Malcolm Hoar):
> In article <lmp2k7-lvc1.ln1@osiris.mauzo.dyndns.org>, Ben Morrow
> <ben@morrow.me.uk> wrote:
> 
> >Malcolm: since I've now got both a clean testcase and a clear
> >understanding of the issue (and probably soon a patch), should I make
> >the bug report?
> 
> I did submit one here:
> 
> http://rt.perl.org/rt3//Public/Bug/Display.html?id=77336

Yeah, I saw that. I've attached a patch to that bug which fixes the
issue.

If you felt so inclined you could probably build a 5.12.1 with that
patch.

Ben



------------------------------

Date: Fri, 20 Aug 2010 19:04:47 GMT
From: malch@malch.com (Malcolm Hoar)
Subject: Re: Perl array bug?
Message-Id: <i4mjkfs0pi002malch@news.sonic.net>

In article <6it2k7-v5q1.ln1@osiris.mauzo.dyndns.org>, Ben Morrow <ben@morrow.me.uk> wrote:
>Yeah, I saw that. I've attached a patch to that bug which fixes the
>issue.
>
>If you felt so inclined you could probably build a 5.12.1 with that
>patch.

Thanks. I'm not really setup for making builds at the moment.
I have pretty much finished testing a workaround for my app
so provided this gets fixed for the next major update, I'm
a very happy camper.

Thanks for your help and support with this Ben. I really
appreciate it.



-- 
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
| Malcolm Hoar           "The more I practice, the luckier I get". |
| malch@malch.com                                     Gary Player. |
| http://www.malch.com/               Shpx gur PQN.                |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


------------------------------

Date: Fri, 20 Aug 2010 22:25:08 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Perldoc: integers *stored* as... ???
Message-Id: <slrni6u064.tb8.nospam-abuse@powdermilk.math.berkeley.edu>

On 2010-08-20, Sal <here@softcom.net> wrote:
> In the online Perl 5 version 12.1 documentation at:
> http://perldoc.perl.org/perlnumber.html#Storing-numbers
>
> Under the heading of Storing Numbers it reads "In fact numbers stored
> in the native integer format may be stored either in the signed native
> form, or in the unsigned native form."
>
> Integers are *stored* as bits in a word, dword, or qword,

Wrong.  Integers are not stored as bits.  They are stored as parts of
SVIV, SVUV, SVNVIV, SVPVIV, SVwhatever else structures.

So your remark makes yet less sense than the sentence in the docs
(which indeed, would benefit from some edits).

Yours,
Ilya


------------------------------

Date: Fri, 20 Aug 2010 13:39:58 -0700 (PDT)
From: king <hara.acharya@gmail.com>
Subject: regular expression for beow text
Message-Id: <a953fe5b-f2e5-4c8b-b7f0-7130dc594087@h17g2000pri.googlegroups.com>

I have a below text like below.
"
 Volume in drive C has no label.
 Volume Serial Number is 4496-C1CF

 Directory of C:\Documents and Settings\Administrator\Desktop\test

08/20/2010  10:01 PM                 0 New WinZip File.zip
08/20/2010  10:01 PM                 0 New WinZip File (2).zip
08/20/2010  10:01 PM                 0 New WinZip File (3).zip
08/20/2010  11:10 PM            11,226 Test_1.txt
08/21/2010  01:56 AM               174 test_2.txt
               5 File(s)         11,400 bytes
               0 Dir(s)  20,658,462,720 bytes free"

I want to have atwo regular expressions where in I will get no of
files as in 5
and the last file name i.e test_2.txt.

I tried the below thing..but I am getting the whole line as out put. I
just need the number 5 as out put and the name of the last modified
file only.
^(\s+)(\d+)(\s)(Fie*)

Can anybody help me with the regular expression?


------------------------------

Date: Fri, 20 Aug 2010 14:52:24 -0700
From: sln@netherlands.com
Subject: Re: regular expression for beow text
Message-Id: <k8ut669k6a9er5ll3b5im3o3jehhioair9@4ax.com>

On Fri, 20 Aug 2010 13:39:58 -0700 (PDT), king <hara.acharya@gmail.com> wrote:

>I have a below text like below.
>"
> Volume in drive C has no label.
> Volume Serial Number is 4496-C1CF
>
> Directory of C:\Documents and Settings\Administrator\Desktop\test
>
>08/20/2010  10:01 PM                 0 New WinZip File.zip
>08/20/2010  10:01 PM                 0 New WinZip File (2).zip
>08/20/2010  10:01 PM                 0 New WinZip File (3).zip
>08/20/2010  11:10 PM            11,226 Test_1.txt
>08/21/2010  01:56 AM               174 test_2.txt
>               5 File(s)         11,400 bytes
>               0 Dir(s)  20,658,462,720 bytes free"
>
>I want to have atwo regular expressions where in I will get no of
>files as in 5
>and the last file name i.e test_2.txt.
>
>I tried the below thing..but I am getting the whole line as out put. I
>just need the number 5 as out put and the name of the last modified
>file only.
>^(\s+)(\d+)(\s)(Fie*)
>
>Can anybody help me with the regular expression?

There are a lot of output options for the dir command.
Try 'dir \B'

Used your way:
/^[\d\/]+ \s+ [\d:]+ \s+ [APM]+ \s+ [\d,]+ \s+ ([^\n]+) /x

-sln


------------------------------

Date: Fri, 20 Aug 2010 15:14:20 -0700
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: regular expression for beow text
Message-Id: <200820101514200928%jimsgibson@gmail.com>

In article
<a953fe5b-f2e5-4c8b-b7f0-7130dc594087@h17g2000pri.googlegroups.com>,
king <hara.acharya@gmail.com> wrote:

> I have a below text like below.
> "
>  Volume in drive C has no label.
>  Volume Serial Number is 4496-C1CF
> 
>  Directory of C:\Documents and Settings\Administrator\Desktop\test
> 
> 08/20/2010  10:01 PM                 0 New WinZip File.zip
> 08/20/2010  10:01 PM                 0 New WinZip File (2).zip
> 08/20/2010  10:01 PM                 0 New WinZip File (3).zip
> 08/20/2010  11:10 PM            11,226 Test_1.txt
> 08/21/2010  01:56 AM               174 test_2.txt
>                5 File(s)         11,400 bytes
>                0 Dir(s)  20,658,462,720 bytes free"
> 
> I want to have atwo regular expressions where in I will get no of
> files as in 5
> and the last file name i.e test_2.txt.
> 
> I tried the below thing..but I am getting the whole line as out put. I
> just need the number 5 as out put and the name of the last modified
> file only.
> ^(\s+)(\d+)(\s)(Fie*)
> 
> Can anybody help me with the regular expression?

That regular expression will work (provided you correct your spelling
error) if applied to the correct line. The number '5' should be in the
variable $2 after that regular expression is applied to the correct
line. The reason that you are "getting the whole line as output" cannot
be explained because you do not show us your program.

Please post a short-but-complete program that illustrates the problem
you are having. If you do that, someone can surely help you.

Thanks.

-- 
Jim Gibson


------------------------------

Date: Fri, 20 Aug 2010 16:20:57 -0600
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: regular expression for beow text
Message-Id: <i4mv4f$b65$1@news.eternal-september.org>

king wrote:
> I have a below text like below.
> "
>  Volume in drive C has no label.
>  Volume Serial Number is 4496-C1CF
> 
>  Directory of C:\Documents and Settings\Administrator\Desktop\test
> 
> 08/20/2010  10:01 PM                 0 New WinZip File.zip
> 08/20/2010  10:01 PM                 0 New WinZip File (2).zip
> 08/20/2010  10:01 PM                 0 New WinZip File (3).zip
> 08/20/2010  11:10 PM            11,226 Test_1.txt
> 08/21/2010  01:56 AM               174 test_2.txt
>                5 File(s)         11,400 bytes
>                0 Dir(s)  20,658,462,720 bytes free"
> 
> I want to have atwo regular expressions where in I will get no of 
> files as in 5 and the last file name i.e test_2.txt.
> 
> I tried the below thing..but I am getting the whole line as out put.
> I just need the number 5 as out put and the name of the last modified
>  file only. ^(\s+)(\d+)(\s)(Fie*)
> 
> Can anybody help me with the regular expression?

It would be helpful if you posted an actual script that we could run,
rather than just a regex that looks like it was retyped, rather than
copied and pasted. You are matching the line you want, but you don't
show us what you do with that match the "gets" you the whole line, or
how you attempt to isolate the file count.

Data in nice, neat columns begs to be split. Do you need a regex, or do
you need to isolate the number of files and the name of the last file
listed?

Post a complete script that demonstrates your problem, and someone here
can help you fix it.


------------------------------

Date: Fri, 20 Aug 2010 17:41:11 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: regular expression for beow text
Message-Id: <slrni6u0sg.7v0.tadmc@tadbox.sbcglobal.net>

king <hara.acharya@gmail.com> wrote:
> I have a below text like below.
> "
>  Volume in drive C has no label.
>  Volume Serial Number is 4496-C1CF
>
>  Directory of C:\Documents and Settings\Administrator\Desktop\test
>
> 08/20/2010  10:01 PM                 0 New WinZip File.zip
> 08/20/2010  10:01 PM                 0 New WinZip File (2).zip
> 08/20/2010  10:01 PM                 0 New WinZip File (3).zip
> 08/20/2010  11:10 PM            11,226 Test_1.txt
> 08/21/2010  01:56 AM               174 test_2.txt
>                5 File(s)         11,400 bytes
>                0 Dir(s)  20,658,462,720 bytes free"


Please post Real Perl Code that does not generate warnings.

Have you seen the Posting Guidelines that are posted here frequently?


> I want to have atwo regular expressions 


Sorry I could not help you, but just in case anybody else is
reading this and would be willing to accept one regular expression,
I'll throw that out there...


> where in I will get no of
> files as in 5
> and the last file name i.e test_2.txt.

> Can anybody help me with the regular expression?

---------------------------------------
#!/usr/bin/perl
use warnings;
use strict;

$_ =
'
 Volume in drive C has no label.
 Volume Serial Number is 4496-C1CF

 Directory of C:\Documents and Settings\Administrator\Desktop\test

08/20/2010  10:01 PM                 0 New WinZip File.zip
08/20/2010  10:01 PM                 0 New WinZip File (2).zip
08/20/2010  10:01 PM                 0 New WinZip File (3).zip
08/20/2010  11:10 PM            11,226 Test_1.txt
08/21/2010  01:56 AM               174 test_2.txt
               5 File(s)         11,400 bytes
               0 Dir(s)  20,658,462,720 bytes free';

my($fname, $fcount) = /(\S+)\s+(\d+)\s+\QFile(s)/;
print "$fname, $fcount\n";
---------------------------------------


Note that it will fail horribly if you happen to have a
filename that starts with "File(s)" as in:

08/20/2010  10:01 PM                 8 File(s)OfStuff.zip


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.


------------------------------

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:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 V11 Issue 3089
***************************************


home help back first fref pref prev next nref lref last post