[28732] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 10096 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 25 21:05:53 2006

Date: Mon, 25 Dec 2006 18:05:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 25 Dec 2006     Volume: 10 Number: 10096

Today's topics:
    Re: BEST PERL BOOK FOR SYSTEM ADMINISTRATION UNIX <tadmc@augustmail.com>
    Re: DHCP server <m@remove.this.part.rtij.nl>
        Negative Regular Expression rand007@gmail.com
    Re: Negative Regular Expression <jurgenex@hotmail.com>
    Re: Negative Regular Expression <craigkb@gmail.com>
    Re: Negative Regular Expression rand007@gmail.com
    Re: Negative Regular Expression rand007@gmail.com
    Re: Negative Regular Expression rand007@gmail.com
        Perl Module to search in a directory and sub-directorie <graham@letsgouk.com>
    Re: Perl Module to search in a directory and sub-direct <jurgenex@hotmail.com>
    Re: Perl Module to search in a directory and sub-direct (on aioe)
        Why would I use Perl in place of C/C++? sl123@netherlands.area
    Re: Why would I use Perl in place of C/C++? <bik.mido@tiscalinet.it>
    Re: Why would I use Perl in place of C/C++? <craigkb@gmail.com>
    Re: Why would I use Perl in place of C/C++? <bik.mido@tiscalinet.it>
    Re: Why would I use Perl in place of C/C++? <cwilbur@chromatico.net>
    Re: Why would I use Perl in place of C/C++? <tadmc@augustmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 25 Dec 2006 14:29:02 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: BEST PERL BOOK FOR SYSTEM ADMINISTRATION UNIX
Message-Id: <slrnep0d4e.pfe.tadmc@tadmc30.august.net>

Michele Dondi <bik.mido@tiscalinet.it> wrote:
> On Sat, 23 Dec 2006 19:34:10 -0600, Tad McClellan
><tadmc@augustmail.com> wrote:
>
>>> Subject: BEST PERL BOOK FOR SYSTEM ADMINISTRATION UNIX
> [snip]
>>Any of the tutorials mentioned in the Perl FAQ.
>>
>>   perldoc -q book
>
> Also, today I went around by my town and I also enterd the bookstore
> which probably has the biggest CS section here. I gave a quick look at
> the Perl books, and I noticed a "Minimal Perl" one which should be
> aimed precisely at UNIX/Linux sysadmins. I can't comment on the book
> proper, but the latter has a foreword by ("that") Conway, and I don't
> believe in the principle of authority in general, but a priori that's
> a sort of guarantee...


Tim Maher is the Real Deal, so I expect that his is a fine book too,
though I have not read it.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Tue, 26 Dec 2006 00:48:10 +0100
From: Martijn Lievaart <m@remove.this.part.rtij.nl>
Subject: Re: DHCP server
Message-Id: <pan.2006.12.25.23.48.10.543388@remove.this.part.rtij.nl>

On Sun, 24 Dec 2006 05:25:57 -0800, Andy Rabagliati wrote:

> Folks,
> 
>   I am trying to make http://unixgu.ru/tmp/ctf-dhcpd/test.pl work, as I
>   need a DHCP server that can pull the leases from LDAP.
> 
>   The ldap patches to the ISC DHCP server also do not work for me,
>   but the schema seems way too complicated in that case also.
> 
>   I have the LDAP lookups working, and sendAnswer (in the perl script)
>   says it is working, but my clients do not receive an answer.
> 
>   The routine in question is sendAnswer below. I usually have a
>   firewall on this machine, but it is configured to accept any traffic
>   from the LAN.
> 
>   A regular DHCP server works, and I have tried turning the firewall
>   off, without success.

Start wireshark (formerly ethereal) and look at the differences from a
working DHCP server and yours.

HTH,
M4
-- 
Redundancy is a great way to introduce more single points of failure.



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

Date: 25 Dec 2006 03:41:34 -0800
From: rand007@gmail.com
Subject: Negative Regular Expression
Message-Id: <1167046894.092185.123990@79g2000cws.googlegroups.com>

Hi,

I am trying to write a simple regular expression that returns a match
for each
string that does not contain specific suffix (e.g. all file names that
do not end with ".txt" extension).

I tried various negative look ahead assertions such as /.+(?!\.txt)/,
/.+(?!\.txt$)/,
/([a-z]|(A-Z)|[0-9])(?!\.txt$)/ and much more, but all of them does not
achieve this specific purpose.

Is there a way to accomplish this task with perl regular expressions?

Thanks,
Ran.



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

Date: Mon, 25 Dec 2006 11:46:42 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Negative Regular Expression
Message-Id: <CSOjh.4996$6Z5.4800@trndny01>

rand007@gmail.com wrote:
> Hi,
>
> I am trying to write a simple regular expression that returns a match
> for each
> string that does not contain specific suffix (e.g. all file names that
> do not end with ".txt" extension).
>
> I tried various negative look ahead assertions such as /.+(?!\.txt)/,
> /.+(?!\.txt$)/,
> /([a-z]|(A-Z)|[0-9])(?!\.txt$)/ and much more, but all of them does
> not achieve this specific purpose.
>
> Is there a way to accomplish this task with perl regular expressions?

Is there a specific reason why you are making the task difficult or would a 
simple solution work, too?

use File::Basename;
($name,$path,$suffix) = fileparse($fullname,@suffixlist);
if ($suffix ne 'txt') {
    #whatever you want to do with that file
}

jue 




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

Date: 25 Dec 2006 04:01:46 -0800
From: "PoisonPen" <craigkb@gmail.com>
Subject: Re: Negative Regular Expression
Message-Id: <1167048106.568316.259950@48g2000cwx.googlegroups.com>

Assuming you have $filename defined:

if ($filename !~ /\.txt$/) {
  # do whatever with this file
}



J=FCrgen Exner wrote:
> rand007@gmail.com wrote:
> > Hi,
> >
> > I am trying to write a simple regular expression that returns a match
> > for each
> > string that does not contain specific suffix (e.g. all file names that
> > do not end with ".txt" extension).
> >
> > I tried various negative look ahead assertions such as /.+(?!\.txt)/,
> > /.+(?!\.txt$)/,
> > /([a-z]|(A-Z)|[0-9])(?!\.txt$)/ and much more, but all of them does
> > not achieve this specific purpose.
> >
> > Is there a way to accomplish this task with perl regular expressions?
>
> Is there a specific reason why you are making the task difficult or would=
 a
> simple solution work, too?
>
> use File::Basename;
> ($name,$path,$suffix) =3D fileparse($fullname,@suffixlist);
> if ($suffix ne 'txt') {
>     #whatever you want to do with that file
> }
>=20
> jue



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

Date: 25 Dec 2006 04:03:10 -0800
From: rand007@gmail.com
Subject: Re: Negative Regular Expression
Message-Id: <1167048190.858583.256600@h40g2000cwb.googlegroups.com>

Hi Jue.

Thanks for the quick response.

You are absolutely right that the file suffix extension I mentioned is
a specific example that can be easily solved with your suggested code,
but what I am looking for is a generic capability for matching strings
that do not end with certains suffix as part of regular expressions
engine capabilities.

Why?
Because I want one engine that can perform this generic task on any
string input without
writing dedicated code for each task.

Ran.

for
J=FCrgen Exner wrote:
> rand007@gmail.com wrote:
> > Hi,
> >
> > I am trying to write a simple regular expression that returns a match
> > for each
> > string that does not contain specific suffix (e.g. all file names that
> > do not end with ".txt" extension).
> >
> > I tried various negative look ahead assertions such as /.+(?!\.txt)/,
> > /.+(?!\.txt$)/,
> > /([a-z]|(A-Z)|[0-9])(?!\.txt$)/ and much more, but all of them does
> > not achieve this specific purpose.
> >
> > Is there a way to accomplish this task with perl regular expressions?
>
> Is there a specific reason why you are making the task difficult or would=
 a
> simple solution work, too?
>
> use File::Basename;
> ($name,$path,$suffix) =3D fileparse($fullname,@suffixlist);
> if ($suffix ne 'txt') {
>     #whatever you want to do with that file
> }
>=20
> jue



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

Date: 25 Dec 2006 04:36:36 -0800
From: rand007@gmail.com
Subject: Re: Negative Regular Expression
Message-Id: <1167050196.373672.108940@a3g2000cwd.googlegroups.com>

Guys,

I found the magic look ahead expression that achieves my whish!!!
it goes like this: /^(?!.*strsuffix$)/

This expression matches any string that does not end with "srtsuffix".

Thanks all.
Ran.


rand007@gmail.com wrote:
> Hi Jue.
>
> Thanks for the quick response.
>
> You are absolutely right that the file suffix extension I mentioned is
> a specific example that can be easily solved with your suggested code,
> but what I am looking for is a generic capability for matching strings
> that do not end with certains suffix as part of regular expressions
> engine capabilities.
>
> Why?
> Because I want one engine that can perform this generic task on any
> string input without
> writing dedicated code for each task.
>
> Ran.
>
> for
> J=FCrgen Exner wrote:
> > rand007@gmail.com wrote:
> > > Hi,
> > >
> > > I am trying to write a simple regular expression that returns a match
> > > for each
> > > string that does not contain specific suffix (e.g. all file names that
> > > do not end with ".txt" extension).
> > >
> > > I tried various negative look ahead assertions such as /.+(?!\.txt)/,
> > > /.+(?!\.txt$)/,
> > > /([a-z]|(A-Z)|[0-9])(?!\.txt$)/ and much more, but all of them does
> > > not achieve this specific purpose.
> > >
> > > Is there a way to accomplish this task with perl regular expressions?
> >
> > Is there a specific reason why you are making the task difficult or wou=
ld a
> > simple solution work, too?
> >
> > use File::Basename;
> > ($name,$path,$suffix) =3D fileparse($fullname,@suffixlist);
> > if ($suffix ne 'txt') {
> >     #whatever you want to do with that file
> > }
> >=20
> > jue



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

Date: 25 Dec 2006 04:36:43 -0800
From: rand007@gmail.com
Subject: Re: Negative Regular Expression
Message-Id: <1167050203.284988.233790@42g2000cwt.googlegroups.com>

Guys,

I found the magic look ahead expression that achieves my whish!!!
it goes like this: /^(?!.*strsuffix$)/

This expression matches any string that does not end with "srtsuffix".

Thanks all.
Ran.


rand007@gmail.com wrote:
> Hi Jue.
>
> Thanks for the quick response.
>
> You are absolutely right that the file suffix extension I mentioned is
> a specific example that can be easily solved with your suggested code,
> but what I am looking for is a generic capability for matching strings
> that do not end with certains suffix as part of regular expressions
> engine capabilities.
>
> Why?
> Because I want one engine that can perform this generic task on any
> string input without
> writing dedicated code for each task.
>
> Ran.
>
> for
> J=FCrgen Exner wrote:
> > rand007@gmail.com wrote:
> > > Hi,
> > >
> > > I am trying to write a simple regular expression that returns a match
> > > for each
> > > string that does not contain specific suffix (e.g. all file names that
> > > do not end with ".txt" extension).
> > >
> > > I tried various negative look ahead assertions such as /.+(?!\.txt)/,
> > > /.+(?!\.txt$)/,
> > > /([a-z]|(A-Z)|[0-9])(?!\.txt$)/ and much more, but all of them does
> > > not achieve this specific purpose.
> > >
> > > Is there a way to accomplish this task with perl regular expressions?
> >
> > Is there a specific reason why you are making the task difficult or wou=
ld a
> > simple solution work, too?
> >
> > use File::Basename;
> > ($name,$path,$suffix) =3D fileparse($fullname,@suffixlist);
> > if ($suffix ne 'txt') {
> >     #whatever you want to do with that file
> > }
> >=20
> > jue



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

Date: Mon, 25 Dec 2006 19:05:35 -0000
From: "Graham Stow" <graham@letsgouk.com>
Subject: Perl Module to search in a directory and sub-directories
Message-Id: <4590267f.0@entanet>

Hi,

I need to search for a pattern match within all files in a particular 
directory and all sub-directories of that directory. Is there a Perl module 
that will help me? 




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

Date: Mon, 25 Dec 2006 19:08:06 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Perl Module to search in a directory and sub-directories
Message-Id: <qkVjh.2282$175.1317@trndny05>

Graham Stow wrote:
> I need to search for a pattern match within all files in a particular
> directory and all sub-directories of that directory. Is there a Perl
> module that will help me?

perldoc File::Find

jue 




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

Date: Mon, 25 Dec 2006 13:22:51 -0600
From: "Mumia W. (on aioe)" <paduille.4060.mumia.w@earthlink.net>
Subject: Re: Perl Module to search in a directory and sub-directories
Message-Id: <emp9j5$pt$1@aioe.org>

On 12/25/2006 01:05 PM, Graham Stow wrote:
> Hi,
> 
> I need to search for a pattern match within all files in a particular 
> directory and all sub-directories of that directory. Is there a Perl module 
> that will help me? 
> 
> 

File::Find::Rule

(Newsgroups line trimmed to comp.lang.perl.misc)


-- 
paduille.4060.mumia.w@earthlink.net
http://home.earthlink.net/~mumia.w.18.spam/


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

Date: Mon, 25 Dec 2006 01:04:14 -0800
From: sl123@netherlands.area
Subject: Why would I use Perl in place of C/C++?
Message-Id: <uj4vo292gbfpnfcndihbrjnh1mh6jg6ejm@4ax.com>

After reading different subject lines here I must confess it is a easy task in Windows.
I know a little perl but what if any bennifit is it over normal C et all...?


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

Date: Mon, 25 Dec 2006 12:25:46 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Why would I use Perl in place of C/C++?
Message-Id: <hbcvo2tnqjlctgcclhpqhjnk12q0dqbpbb@4ax.com>

On Mon, 25 Dec 2006 01:04:14 -0800, sl123@netherlands.area wrote:

>After reading different subject lines here I must confess it is a easy task in Windows.
                                                           ^^
                                                           ^^

What? reading different subject lines? Using Perl in place of C/C++?
What?!?

>I know a little perl but what if any bennifit is it over normal C et all...?

To quote from a post I just read, that is
<news:O_Cjh.4909$sz5.479@trndny03>:

: > I do lots of perl programming and I have done lots of writing in C/C++
: > and C#, buts that's the silliest argument I've heard so far.
: 
: If you like convoluted pointer arithmetic, doing garbage collection 
: manually, and not having any operators on any compound data types, then that 
: is certainly your choice. I for my part prefer programming languages that 
: support my way of thinking, not hinder it with technical nonsense.

This is only a hint, granted: the point being that Perl is dynamic
multipurpose multiparadigm language. It can do quite about anything
but is not necessarily extremely efficient at doing any particular
thing. So it is exceptionally well suited in most situations in which
speed is not a terrible issue, the advantage being that it is much
higher level than C/C++, and does quite a lot of things for you. Which
means that you can concentrate on logic rather than on technical
details, and in turn that will make for quite rapid development.

Classical example: a full program that filters input lines outputting
only unique ones in whichever order they come can be a simple oneliner
like the following

  perl -pe"$_ x=!$$_++"

(NOTE: this is a "golfed" solution -quick'n'dirty- I'm not
recommending it, but even the "correct" ones would only be very
slightly longer.)

Do the same in C!!


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: 25 Dec 2006 04:25:54 -0800
From: "PoisonPen" <craigkb@gmail.com>
Subject: Re: Why would I use Perl in place of C/C++?
Message-Id: <1167049554.680587.108450@i12g2000cwa.googlegroups.com>

My 10c worth....agree with Michele's post.

Perl will do almost anything you want, and is far superior in string
operations. Not to mention the beautiful hash data structure.

The main advantage C has over Perl is the speed of the compiled code
(compared to the interpretive mechanism of Perl).

On tests we carried out going through a million phone records (text), C
did the job in 0.5 seconds whereas Perl took 23 seconds.

If you are ripping through vast tracts of data, use C. If not, try
Perl. The Perl libraries available on CPAN will let you do almost
anything you want.


Michele Dondi wrote:
> On Mon, 25 Dec 2006 01:04:14 -0800, sl123@netherlands.area wrote:
>
> >After reading different subject lines here I must confess it is a easy task in Windows.
>                                                            ^^
>                                                            ^^
>
> What? reading different subject lines? Using Perl in place of C/C++?
> What?!?
>
> >I know a little perl but what if any bennifit is it over normal C et all...?
>
> To quote from a post I just read, that is
> <news:O_Cjh.4909$sz5.479@trndny03>:
>
> : > I do lots of perl programming and I have done lots of writing in C/C++
> : > and C#, buts that's the silliest argument I've heard so far.
> :
> : If you like convoluted pointer arithmetic, doing garbage collection
> : manually, and not having any operators on any compound data types, then that
> : is certainly your choice. I for my part prefer programming languages that
> : support my way of thinking, not hinder it with technical nonsense.
>
> This is only a hint, granted: the point being that Perl is dynamic
> multipurpose multiparadigm language. It can do quite about anything
> but is not necessarily extremely efficient at doing any particular
> thing. So it is exceptionally well suited in most situations in which
> speed is not a terrible issue, the advantage being that it is much
> higher level than C/C++, and does quite a lot of things for you. Which
> means that you can concentrate on logic rather than on technical
> details, and in turn that will make for quite rapid development.
>
> Classical example: a full program that filters input lines outputting
> only unique ones in whichever order they come can be a simple oneliner
> like the following
>
>   perl -pe"$_ x=!$$_++"
>
> (NOTE: this is a "golfed" solution -quick'n'dirty- I'm not
> recommending it, but even the "correct" ones would only be very
> slightly longer.)
>
> Do the same in C!!
>
>
> Michele
> --
> {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
> (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
> .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
> 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,



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

Date: Mon, 25 Dec 2006 15:16:52 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Why would I use Perl in place of C/C++?
Message-Id: <09nvo2p30jl2rfs5nkklvb818bamcer4cf@4ax.com>

On 25 Dec 2006 04:25:54 -0800, "PoisonPen" <craigkb@gmail.com> wrote:

>If you are ripping through vast tracts of data, use C. If not, try
>Perl. The Perl libraries available on CPAN will let you do almost
>anything you want.

And if you know both you may write critical section of code in C (XS)
and still do the rest in Perl.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: 25 Dec 2006 13:37:20 -0500
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: Why would I use Perl in place of C/C++?
Message-Id: <87fyb37rfj.fsf@mithril.chromatico.net>

>>>>> "PP" == PoisonPen  <craigkb@gmail.com> writes:

    PP> On tests we carried out going through a million phone records
    PP> (text), C did the job in 0.5 seconds whereas Perl took 23
    PP> seconds.

Ah, but how long did it take you to write?

If it's a one-off job, and the C takes you 3 hours to write while the
Perl takes you 2 and a half hours, the difference between 0.5 seconds
and 23 seconds is foolish to fuss over.  Even if it's something you
need to run daily - an extra 22.5 seconds for a million records is
rarely a dealbreaker.

    PP> If you are ripping through vast tracts of data, use C. If not,
    PP> try Perl. The Perl libraries available on CPAN will let you do
    PP> almost anything you want.

I find Perl most useful for platform-agnostic web programming and for
data processing -- in both cases because I can usually get the job
done quickly and easily by gluing together 3 or 4 modules from CPAN
and a bit of custom logic for the specifics of the task at hand.  I
could do it in C, but the tradeoff in C is brittleness or programmer
time for speed: there are a lot of ways C can break if you're not
careful, and by the time you've accounted for them in the code, the
program has become very large. 

Charlton



-- 
Charlton Wilbur
cwilbur@chromatico.net


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

Date: Mon, 25 Dec 2006 14:36:56 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Why would I use Perl in place of C/C++?
Message-Id: <slrnep0dj8.pfe.tadmc@tadmc30.august.net>

sl123@netherlands.area <sl123@netherlands.area> wrote:

> Subject: Why would I use Perl in place of C/C++?


When you need to optimize developer time at the expense of execution time.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

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 10096
****************************************


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