[12147] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5747 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 21 18:07:31 1999

Date: Fri, 21 May 99 15:00:18 -0700
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, 21 May 1999     Volume: 8 Number: 5747

Today's topics:
        A du type function? <curt@vphos.net>
    Re: Change File Names Recursively (Matthew Bafford)
    Re: Change File Names Recursively <cassell@mail.cor.epa.gov>
    Re: Concatenate RTF files <cassell@mail.cor.epa.gov>
    Re: Dynamic Thumnail Generation?? <propart@mediaone.net>
        Finding Diff of two files anilpn@my-dejanews.com
    Re: Getting Column headers from DB <gellyfish@gellyfish.com>
    Re: Grab string from STDIN <cassell@mail.cor.epa.gov>
    Re: Help.... <gellyfish@gellyfish.com>
        how can I make this code more programmatic? <brannon@quake.usc.edu>
    Re: MacPerl and QuarkXPress??? (Bart Lateur)
    Re: man pages and FAQs: why posted? <dhenders@cpsgroup.com>
    Re: Need help (Bart Lateur)
    Re: perl email <cassell@mail.cor.epa.gov>
    Re: perl oracle on a hp-ux/64 jmartens8855@my-dejanews.com
    Re: Refresh a document in frame <cassell@mail.cor.epa.gov>
    Re: Regular expression ? <aqumsieh@matrox.com>
        Sys::Syslog doesn't work in Perl5.005_03 :-( (Ingo Ciechowski)
    Re: timelocal <cassell@mail.cor.epa.gov>
    Re: Utterly poor perl!! (using index) (Bart Lateur)
        Where can we advertise our perl consultancy services? <gary@hotlava.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Fri, 21 May 1999 14:40:29 -0700
From: Curt Cranfield <curt@vphos.net>
Subject: A du type function?
Message-Id: <3745D2CD.A400C0E@vphos.net>

Hi Everyone,

I am trying to find out if there is a du (du - estimate file space
usage) type function which would be able to tell me how much space a
particular directory is using.

I have checked the perl modules and have found stuff like File::Df and
stat but neither of those seem to give me the information I am looking
for.

Any thoughts?

Thanks for any help.

Curt



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

Date: Fri, 21 May 1999 21:37:02 GMT
From: dragons@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Change File Names Recursively
Message-Id: <slrn7kbijr.hg.dragons@dragons.duesouth.net>

On Fri, 21 May 1999 04:23:09 -0400, Nathan Owen <Nathan.Owen@isocor.com>
held some poor sysadmin at gun point while typing in the following:
: I need to write a simple script which needs to be able to change the case of
: the filenames in a directory from uppercase / mixed case to strictly lower
: case.  Additionally, I need this script to work recursively on any
: subdirectories in the directory in which the script is being run from.

rename 's{([^/]+$)}{\L$1}' `find -depth`

Where rename is:

#!/usr/bin/perl -w
# Stolen from Larry Wall

# Modified to take the eval out of the loop.
# Doing so gained a considerable increase in speed.

$op = shift or die "Usage: rename expr [files]\n";

chomp(@ARGV = <STDIN>) unless @ARGV;

eval "sub change_it{ $op } 1";
die "$@\n$op\n" if $@;

for ( @ARGV ) {
	$was = $_;
	change_it();
	rename($was,$_) unless $was eq $_;
}
__END__

Or, if you don't have find on your system:

rename.ff 'tr/A-Z/a-z/' .

#!/usr/bin/perl -w
# Stolen from Larry Wall
# Modified to bring the eval out of the loop
# Modified to use File::Find

use File::Find;

$op = shift or die "Usage: rename expr [directories]\n";

chomp(@ARGV = <STDIN>) unless @ARGV;

eval "sub change_it{ $op } 1";
die "$@\n$op\n" if $@;

finddepth(\&wanted, @ARGV);

sub wanted {
    $was = $_;
    change_it();
    rename($was, $_) unless $was eq $_;
}
__END__

: Thanks

Hope This Helps,

--Matthew


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

Date: Fri, 21 May 1999 14:57:16 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Change File Names Recursively
Message-Id: <3745D6BC.AA29ECDE@mail.cor.epa.gov>

Nathan Owen wrote:
> 
> I have a Perl newbie question....
> 
> I need to write a simple script which needs to be able to change the case of
> the filenames in a directory from uppercase / mixed case to strictly lower
> case.  Additionally, I need this script to work recursively on any
> subdirectories in the directory in which the script is being run from.
> 
> I have been working with sections 1.9 (changing case) and section 9.7
> (processing all files in a directory recursively) from the Perl Cookbook,
> but can't seem to put it all together.  Any help with this would be greatly
> appreciated.

Sure.  Just post your code here, along with the error messages
you got, or what it did/didn't do right.  Just keep the posted
code under 30 or 40 lines.  And follow the instructions in the
e-mail you got from gnat. (Unless you munged your e-mail address,
in which case you're a bad boy - you're not supposed to do that
on Usenet. :-)
 
> Thanks

HTH,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 21 May 1999 14:53:56 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Concatenate RTF files
Message-Id: <3745D5F4.587A1C02@mail.cor.epa.gov>

David Beckley wrote:
> 
> The program below works fine as it stands, but when opening the merged
> document, Word recognizes only the first of the merged documents.
> Apparently it encounters an end of document code. So I guess I need to

And a lot of other stuff which is clearly not legal parts of a
document, like the next header.

> grab the guts of each document and keep the document header at the top
> of the file and put a document footer at the end of the merged file.
> Any ideas, please? I'm running on NT 4.0
>
> [code snipped]

I think you'll want to do this using the Win32::OLE module
and treat this as an Office Automation exercise.  The nice 
people in the win32-perl-users listserv have more experience
with this than I do.  You can subscribe by going to 
www.activestate.com and following the links to the list
subscription page.

Unless you want to do something like

   $Word->WordBasic->FileSaveAs($file);
 
and save your files in a format which might lose some of your
formatting, you won't want to attack the problem the way that
you have already done.  The headers _et_al_. in word
processing documents can't be handled just by doing a binmode()
on the file.

HTH,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 21 May 1999 17:17:13 -0400
From: PropART <propart@mediaone.net>
Subject: Re: Dynamic Thumnail Generation??
Message-Id: <3745CD59.5C9992A4@mediaone.net>

bob wrote:

> Does anyone know if there is a perl script or equivalent way to create
> 'thumbnails on the fly'...any help is very much appreciated.
>
> thanks,
> robert

Randal Schwartz did a column on thumbnailing in Perl for the Jan. '99 Web
Techniques. The code is posted on his website.

try http://www.stonehenge.com/merlyn/WebTechniques/




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

Date: Fri, 21 May 1999 21:27:35 GMT
From: anilpn@my-dejanews.com
Subject: Finding Diff of two files
Message-Id: <7i4j43$eo9$1@nnrp1.deja.com>

Hi,

I have two files in my vars:
@file & @file2

How can I find the diff of the two
files, using perl in a simple way ?

Thanks
Anil


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: 21 May 1999 21:21:24 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Getting Column headers from DB
Message-Id: <7i4iok$nc$1@gellyfish.btinternet.com>

On Fri, 21 May 1999 14:26:43 -0400 Umashankar Kotturu wrote:
> hi,
> 
> I am accessing MS-access from Perl using dbi drivers.
> 
> When I make a query to the database I get the data. How can I get the
> header also into the program variables ?
> 

If you want to find out the column names you may want to use the
fetchrow_hashref method.  Read the DBI manpage for more on that.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Fri, 21 May 1999 14:20:55 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Grab string from STDIN
Message-Id: <3745CE37.7F7D20D2@mail.cor.epa.gov>

Anand wrote:
> 
> In article <37459B84.2DE0954D@pahv.xerox.com>,
>   "Hall, Johnny" <johnny@pahv.xerox.com> wrote:
> > I
> > don't know how to (a) open the output of sunscan in the script (b)
> > snatch the patch number from the list.  Here is a sample from the
> 
> Warning: Newbie's reply.

Hey Anand, just because you're not The Larry doesn't mean
you need to qualify your replies so self-deprecatingly.
We all make mistakes in this ng sooner or later.  As long as
you tested your code before posting, you should be in good
shape.  And if someone comes along and corrects you, you
learn something.  Just like I learn things from being corrected
by the experts in this ng.

> open(SCAN, "sunscan|");

Always check the status of your open(), even when it's a pipe.

> while (<SCAN>) {

As I understand the output of sunscan [which is admittedly
a weak understanding and not a grok], the lines with patches
are the only lines with the following format, so this only
splits when we *have* a patch number:

     next unless /^\d{6}-\d{2}/;

>    ($patchnum, $os, $patch) = split(/:\s*/);

And use 'my' so you don't accidentally trample on some poor
variable to be used later.

     my ($patchnum, $os, $patch) = split(/:\s*/);

>    # Now $patchnum contains the patch number. Ex: 104854-02
>    # Ex. $os = SunOS 5.5.1
>    # Ex. $patch = troff macro patch.
> }
> 
> [snip]

HTH,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: 21 May 1999 21:13:19 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help....
Message-Id: <7i4i9f$mv$1@gellyfish.btinternet.com>

On Fri, 21 May 1999 20:04:08 +0100 Tim Shapcott wrote:
> Hi
> I am really new to cgi/perl and i can't figure out why this doesn't work.
> Any help would be really appreciated.
> 
> 
> begin 666 guest.cgi
> M(R$O=7-R+VQO8V%L+V)I;B]P97)L#0H-"B1D:7)E8W1O<GE?9V)O;VL@/2 B
> 

That doesnt look like Perl to me ... Its generally considered poor taste
to post anything other than plain text here.

Having UUDecoded this stuff and run it with perl -c it is obvious what
was wrong with it - what part of :


Bareword found where operator expected at guest.cgi line 70, near ""<tr valign=top><td><h3>Email Address</h3></td> <td><b><a href="mailto"
	(Missing operator before mailto?)
syntax error at guest.cgi line 70, near ""<tr valign=top><td><h3>Email Address</h3></td> <td><b><a href="mailto"

Are you having difficulty with - it is described in the perldiag manpage.

In general you will probably find it easier to avoid problems if you use
the generalized quote operator qq{} as described in the perlop manpage
under the heading "QUOTE AND QUOTE-LIKE OPERATORS".  Indeed when you are
printing large blocks of text you probably want to use the here-doc like:

print <<EEEE;
blah blah blah stuff to
be printed
EEEE

Anyhow here is the patch :

70c70
< 				print GUEST "<tr valign=top><td><h3>Email Address</h3></td> <td><b><a href="mailto:$FORM{'email'}\"> $FORM{'email'}</a></b></td></tr>\n";
---
> 				print GUEST "<tr valign=top><td><h3>Email Address</h3></td> <td><b><a href=\"mailto:$FORM{'email'}\"> $FORM{'email'}</a></b></td></tr>\n";
76c76
< 				print GUEST "<tr valign=top><td><h3>How you found the site</h3></td> <td><b>$FORM{'howfind'}"</b></td></tr>\n";
---
> 				print GUEST "<tr valign=top><td><h3>How you found the site</h3></td> <td><b>$FORM{'howfind'}</b></td></tr>\n";
98c98
< print "<h1 align="center">Thankyou $FORM{'name'}!<BR>\n";
---
> print "<h1 align=\"center\">Thankyou $FORM{'name'}!<BR>\n";
160c160
< 	print "<h1 align="center">No Email</h1><BR>\n";
---
> 	print "<h1 align=\"center\">No Email</h1><BR>\n";


/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 21 May 1999 14:31:40 -0700
From: tbrannon <brannon@quake.usc.edu>
Subject: how can I make this code more programmatic?
Message-Id: <ysizhfp6p0sn.fsf@nunki.usc.edu>

As you can see, the same thing is being done, but I simply need it
done with A,B, and S. How might I make this task more programmatic and
less of a cut-and-paste job?

open A, 'a.dat';
open B, 'b.dat';
open S, 'a+b.dat';

@A=<A>;
@a=split '\s+', $A[1];
@B=<B>;
@b=split '\s+', $B[1];
@S=<S>;
@s=split '\s+', $S[1];


-- 
   Terrence Brannon  * brannon@lnc.usc.edu * http://lnc.usc.edu/~brannon
		(213) 740-3397 [office] (323) 294-3028 [home]


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

Date: Fri, 21 May 1999 21:57:08 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: MacPerl and QuarkXPress???
Message-Id: <3745cbaa.5656835@news.skynet.be>

Mats Pettersson wrote:

>I'm currently trying to do a apple-script for QuarkXPress. However
>expressions isn't apple-scripts greatest strength, so i thought i should
>try MacPerl.

Expressions? What kind of expressions?

>I couldn't find any info how to intergrate apple-script with perl or if
>it is possible in any way.

You DON'T want to do that. Copmpilation of a simple 5 line Applescript
in Perl can take up to a few seconds, depending on your machine. It
needs to be done again and again, every time a script snippet is run. It
takes forever.

>Anybody tried scripting Quark with perl, or if somone could point me to
>any similar information.

Not yet. :-)

Native AppleEvents (the stuff beneath the surface of Applescript) in
MacPerl, aren't too user-friendly yet. Watch Chris Nandor's activities.
He's working on Mac::Glue, which eventually will make writing this stuff
in "native" Perl virtually as easy as in AppleScript. Only: not just
yet.

What I personally do (and have been doing for a few years now), is that
I have written a general Applescript program which takes SIMPLE commands
from a text file, and puts stuff in a QXP document. I use a
tab-delimited text file. Example contents:

textbox	26	100	120	15.2
 .border	1.2	black	80

This makes a basic textbox with coordinates x=100mm, y=120mm,
width=120mm, height=15.2mm, and then gives this textbox (the "active
generic box") a border of 1.2pt, color is 80% black. I hope you get the
concept. It reads this datafile one line at a time, and I made use of
Applescript's text item delimiters, which is set to tab, to split the
parameters, see what it's supposed to do, and does it. It's acceptably
fast.

Of course, I use Perl to convert the output files (whatever text format)
from the database into the format this AppleScript desires, making use
of template files where you insert the variable stuff at the appropriate
places.

Well, I hope this helps.

	Bart.


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

Date: 21 May 1999 16:22:36 -0500
From: Dale Henderson <dhenders@cpsgroup.com>
Subject: Re: man pages and FAQs: why posted?
Message-Id: <87yaiit8wz.fsf@camel.cpsgroup.com>

>>>>> "Tom" == Tom Christiansen <tchrist@mox.perl.com> writes:

    Tom>  [courtesy cc of this posting sent to cited author via email]
    Tom> In comp.lang.perl.misc, "Matthew O. Persico"
    Tom> <mpersico@erols.com> writes: 

    Tom> :And what, pray tell, if anything, are you intending to
    Tom> replace it with?

    Tom>     % man ucfirst

     The problem with that is I already have two possiblities when I
     type 
     
     $ man printf
     

     printf (1)           - format and print data
     
     printf, fprintf, sprintf, snprintf, vprintf, vfprintf, vsprintf,
     vsnprintf (3) - formatted output conversion
     
     I really don't want three.

     The Tcl docs can be annoying as well.


     now if perl had it's own section (say 3p or 3perl).



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

Date: Fri, 21 May 1999 21:57:12 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Need help
Message-Id: <3746cf9b.6665917@news.skynet.be>

Suzy wrote:

>what we want is:
>Name: Maria
>Initials: MJ
>Last name: Steen-van Buizen
>Infix: van der

That ain't right. I bet her maiden name is "van Buizen", and her
husband's name is "van der Steen". See: it's not even possible to get a
consensus on what part is what. How do you expect a script to work
right, in all cases?

p.s. Sorry for this off-topic "answer"! :-)

	Bart.


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

Date: Fri, 21 May 1999 14:37:34 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: perl email
Message-Id: <3745D21E.1662C5A7@mail.cor.epa.gov>

Barth, Brian (EXCHANGE:BNRTP:0S31) wrote:
> 
> how do you send an email from a perl script?
> the script is called from another script and i want send an email to an
> address which is passed to the script when called.
> i have a readparse subroutine to get the info in the call
> 
> so i need some sort of format to send it:
>     to: $address
>     from : $sender
>     subject: $description
>     body: $main_info
> 
> is there an easy way of doing this? it doesnt need to be pretty, just
> functional

You'll be surprised how easy it is.  All you have to do is
read the FAQ, and you'll find code in there to do it.  In fact,
the FA Question "How do I send mail?" has more than one way to
do it.  (This is Perl, after all. :-)

So just type at the command line:

   perldoc perlfaq9

and scan down to the aforementioned question.  If you have
the HTML docs too, you can browse perlfaq9 and click your
way to the answer.

Learn how to use all the fabulous documentation that comes
with Perl.  You'll be amazed when you compare it to the
skimpy tidbits that tag along with many languages.

HTH,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 21 May 1999 21:06:27 GMT
From: jmartens8855@my-dejanews.com
Subject: Re: perl oracle on a hp-ux/64
Message-Id: <7i4hsh$dkh$1@nnrp1.deja.com>

In article <7i4eum$bob$1@nnrp1.deja.com>,
  mark_f_edwards@my-dejanews.com wrote:
> has anyone successfully gotten perl to work with oracle
>
> on an hp 64 bit machine??
>
> the pro*c programs precompile, compile, and link successfully, so that
> tells me that it must be possible!
>
> any help will be GREATLY appreciated!
> mark.edwards@sunh.com
>
> --== Sent via Deja.com http://www.deja.com/ ==--
> ---Share what you know. Learn what you don't.---
>

Yep.

I had to build DBD/Oracle statically, however. I also had to build
another perl JUST to use DBD. No real big deal, it was great fun (whoop,
sorry, some sarcasm is creeping in. Heh!). I had a perl binary that was
roughly 3MB in size at the end of it.

It works, though.

Try building it statically first. Check which oracle objects you have
installed - some you may have to copy from another system (or
temporarily install them until after you build statically, then remove
them..).

My .02..however, if anyone can get it working dynamically, I wouldn't
mind knowing that either..<grin>

James


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Fri, 21 May 1999 13:59:35 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Refresh a document in frame
Message-Id: <3745C937.AC225CBE@mail.cor.epa.gov>

J|rgen Exner wrote:
> 
> Karpat <karpat@eeh.ee.ethz.ch> wrote in message
> news:37451D9F.EF784174@eeh.ee.ethz.ch...
> > Could somebody help me with such small problem:
> > I have two frames, the user fills a form in the first frame, on the base
> > of his input I add something to the document, which is seen in the
> > second frame. Can I make browser to refresh the second frame?
> 
> And ..... where's your Perl problem?

But, you see, that *is* Karpat's Perl problem.  He doesn't
yet realize that he is asking a CGI question, and should be
reading the FAQ for comp.infosystems.www.authoring.cgi
before posting in their newsgroup.  He isn't distinguishing
between browsers and the CGI protocol and the Perl programming
language.

To use an O'Reilly-esque metaphor, it's a mouse in camel's
clothing.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 21 May 1999 16:13:23 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Regular expression ?
Message-Id: <x3yemka18rg.fsf@tigre.matrox.com>


Ala Qumsieh <aqumsieh@matrox.com> writes:

> > my @heads = split ' ' , <DATA>;     # column headers  (names)
> 
> The above line doesn't probably do what you want. It reads in all of
> your inputfile, and splits it on any combination of white
> space. 

Oops. This of course if wrong. It reads in *one* line from the file and
splits it on any combination of white space. You should still look at
$/ in perlvar if what you want is to parse emails :-)

Ala



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

Date: Fri, 21 May 1999 23:08:06 +0200
From: ciechowski@cis-computer.com (Ingo Ciechowski)
Subject: Sys::Syslog doesn't work in Perl5.005_03 :-(
Message-Id: <ciechowski-ya023280002105992308060001@news.nacamar.de>

Hi folks,

I've got a problem using the Sys::Syslog package on my linux 2.0.36 system
with Perl Perl5.005_03...


Using the following code snippet I unfortunately don't get any output in my
syslogs and no errors from perl :-(


#!/usr/bin/perl

use Sys::Syslog;

openlog('testprg', 'perrer', 'local2');
syslog("local2|info" , 'this is my test');
closelog();



syslog.conf of course takes care of the local2 stuff 
  ...
  local2.*                        -/var/log/mylog
  ...

and the examples from the Sys::Syslog manpage don't work either :-((



-----

however, when I stick to standard C and go with the following code
everything works as expected:

#include <syslog.h>

main()
{
        openlog("TEST", LOG_PERROR, LOG_LOCAL2);
        syslog(LOG_LOCAL2|LOG_INFO, "test from .c\n");
        closelog( );
}



Is there any known problem with Sys::Syslog in Perl5.005_03, do I simply
misunderstand something here or does someone have a real great idea to
solve that without writing a C wrapper myself?

Any help's really appreciated ;-)


Ingo
ciechowski@cis-computer.com


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

Date: Fri, 21 May 1999 14:28:13 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: timelocal
Message-Id: <3745CFED.AA511DC9@mail.cor.epa.gov>

huichai@my-dejanews.com wrote:
> 
> Hi,
> 
> I'm noticing some strange behavior with the timelocal() function.
> I have a script which takes the output from the unix 'date' command
> and translates it into unix time.  When I run the program in
> debug mode, it returns the right unix time, but when it is run
> not in debug mode, it returns a -1.

Umm, why do you want to do this?  Perl can do this with no
system() call to 'date' at all.

> according to the man page, the routine returns -1 if the integer
> limit is hit. I.e. for dates after the 1st of January, 2038 on
> most machines, which is not my case.

Then you're probably doing something interesting, like
accidentally feeding seconds since the Unix epoch to the 
function, instead of *days* since the epoch.

> but why would it behave differently in debug mode?

It's pretty hard to tell since you didn't tell us what
you're trying to do, or show us any code, or *anything*.
There are some really bright people in this ng, but no
one from the Psychic Friends Hotline.  :-)
 
> thanks,

HTH,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 21 May 1999 21:57:25 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Utterly poor perl!! (using index)
Message-Id: <3747d0e4.6995412@news.skynet.be>

Richard Lawrence wrote:

>Here is some utterly poor code to take each line from a file txt.txt
>and see if that line contains the words on the command line ie.
>
>prog.pl fish          -- will list all lines with fish in it
>prog.pl fish chips    -- will list all lines with fish AND chips in it

Hmm... I like to build Perl code on the fly, "eval" it to get a working
tester sub, and then apply this sub to every line. Oh: the //i modifier
makes the test case insensitive.

So my stab at this is:

    my @request = @ARGV; #for now
    my $code = join ' && ', map { "/\\b\Q$_\E\\b/i" } @request;
    my $sub = eval "sub { $code }";
    defined $sub or die "Improper query: $code";
    while(<DATA>) {
        $sub->() #call sub
          and print "Got a match ($.): $_";
    }
__DATA__
Data courtesy of Andrew Johnson :-)
blah fish and chips
blah just fish
ChiPs blah fish blah

Eek! It works!

	Bart.


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

Date: Fri, 21 May 1999 14:26:41 -0700
From: Gary Howland <gary@hotlava.com>
Subject: Where can we advertise our perl consultancy services?
Message-Id: <3745CF91.71DDFA2@hotlava.com>

Are there any sites (there certainly don't seem to be any newsgroups)
for hiring oneself out as a Perl consultant?

best regards,

Gary Howland <gary@hotlava.com>



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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 5747
**************************************

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