[7191] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 816 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 5 13:17:28 1997

Date: Tue, 5 Aug 97 10:00:24 -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           Tue, 5 Aug 1997     Volume: 8 Number: 816

Today's topics:
     Re: Buy any Perl book in print <rootbeer@teleport.com>
     Re: Can I use a sub within a sub? <rootbeer@teleport.com>
     Re: Can I use a sub within a sub? <fnord@panix.com>
     Creating a lynx -dump script? (Lois Patterson)
     Re: Determining the most efficient method of... <rra@stanford.edu>
     Re: Determining the most efficient method of... <ajohnson@gpu.srv.ualberta.ca>
     editing files via cgi (Mark D)
     Re: file extensions <clark@s3i.com>
     GROVEL: script that capitalizes unix filenames (Mark E. Crane)
     Re: How to add users to .htpasswd <Jacqui.Caren@ig.co.uk>
     Re: How-to cut the last characters of a varibles <rootbeer@teleport.com>
     Re: howto change variable to Variable <rootbeer@teleport.com>
     Re: Inserting within a string? (Tim  Smith)
     IS there DBM Stuff containing (Joonas Timo Taavetti Kekoni)
     JAPH (was: function pointer dereferencing) <tom@mitra.phys.uit.no>
     Re: JAPH (was: function pointer dereferencing) <rootbeer@teleport.com>
     Re: JAPH (was: function pointer dereferencing) <rootbeer@teleport.com>
     Re: JAPH (was: function pointer dereferencing) <merlyn@stonehenge.com>
     Re: JAPH (was: function pointer dereferencing) (M.J.T. Guy)
     Re: Please help re:  reg exp from command line... (Tim  Smith)
     Re: Printing to absolute screen position (Honza Pazdziora)
     Problems with Internet Explorer running a PERL script kennedycy@thecb.state.tx.us
     Programmers Wanted For WebObjects & PERL Internet/Intra bruce@evolution.com
     PROGRAMMERS WANTED (Ari Burton)
     Running Perl under Windows - No NFS <jerryp.usenet@SPAMconnected.demon.co.uk>
     Re: Saving the state of a form from invocation to invoc <rootbeer@teleport.com>
     searching (ms)troff2html <patrick@arch.ethz.ch>
     Re: Simple perl question (Tim  Smith)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 4 Aug 1997 17:50:17 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Dan Harper <dwharper@ingr.com>
Subject: Re: Buy any Perl book in print
Message-Id: <Pine.GSO.3.96.970804174959.12101N-100000@kelly.teleport.com>

On Mon, 4 Aug 1997, Dan Harper wrote:

> Your post is a joke, right?

I don't know about yours, but this one is. Not very funny, though....

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 4 Aug 1997 17:49:29 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Derrick Miller <derrickm@herald-mail.com>
Subject: Re: Can I use a sub within a sub?
Message-Id: <Pine.GSO.3.96.970804174754.12101M-100000@kelly.teleport.com>

On Mon, 4 Aug 1997, Derrick Miller wrote:

> In Perl, can I call a subroutine from another subroutine??

Yes. You can even call the same sub from within itself, recursively.

> In other words, will the following code snippet work? 

> sub main_menu {
>         @print_popup;
> }

Yes, but it won't do what you want. :-)  It's returning the list
@print_popup. It's not calling the sub &print_popup. Gotta use the right
punctuation! :-)

See perlsub(1) for more info. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 4 Aug 1997 22:58:12 -0400
From: Cliff Heller <fnord@panix.com>
Subject: Re: Can I use a sub within a sub?
Message-Id: <upoh7dz67w.fsf@panix.com>

Derrick Miller <derrickm@herald-mail.com> writes:

> In other words, will the following code snippet work? I have something
> very similar, and @print_popup works when called from the main program
> body, but not when called from within @main_menu. It is making me angry.
> Please help.

am I missing something?  Aren't subroutines called with '&' and arrays
referenced with '@'

> 
> @main_menu;
> 
> sub main_menu {
>         @print_popup;
> }
> 
> sub print_popup{
>         print "<SELECT NAME=\"choice1\">\n";
> 		print "<OPTION VALUE=\"Yes\">Yes</OPTION>\n";
> 		print "<OPTION VALUE=\"No\">No</OPTION>\n";
> 		print "</SELECT>";
> }

-- 
    / \      Left Reverend Nigh Invulnerable            fnord@panix.com
   /<0>\     Church of the Subverted Paradigm
  /     \                                               God Plays Dice!
 /_______\    --> FIVE TONS OF FLAX <--          Death To All Fanatics! 


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

Date: 3 Aug 1997 16:54:26 -0700
From: lpat@unixg.ubc.ca (Lois Patterson)
Subject: Creating a lynx -dump script?
Message-Id: <5s35ni$8hl@netinfo1.ubc.ca>


I know how to use the lynx -dump command like this:

lynx -dump http://www.someserver.com/file1.html >file1

to dump the contents to file1

What I would like to know how to do is to be able to
run a script so that I could do something like


lynx -dump http://www.someserver.com/fileK.html >fileK

for a large group of files ranging from 1 to N without having
to run the command each time.
 
How would I do that?
 
Thanks for any help,
 
 
Lois Patterson
lpat@unixg.ubc.ca


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

Date: 04 Aug 1997 18:03:26 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Determining the most efficient method of...
Message-Id: <m3d8nth25d.fsf@windlord.Stanford.EDU>

ucs@ [munged address] writes:

> In reading the posts in the NG, I frequently encounter comments
> regarding execution speed and resource consumption:

> 1) So, are there any general rules for figuring this out on my own? 

I'll leave most of this to other people that I know are more qualified
(Ilya has done *tons* of work in this regard), but the two things you
should be aware of are Benchmark and Devel::DProf.  Benchmark comes with
Perl; you should be able to just type perldoc Benchmark to get the
documentation.  It's the first thing to use when checking execution
speed.  Devel::DProf you'll need to get from CPAN.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Mon, 04 Aug 1997 20:05:34 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Determining the most efficient method of...
Message-Id: <33E67C5E.10971D3A@gpu.srv.ualberta.ca>

ucs@ (ucs) wrote:
> 
> In reading the posts in the NG, I frequently encounter comments regarding
> execution speed and resource consumption:
> 
> 1) So, are there any general rules for figuring this out on my own?
> 
> e.g. use system programs like sort when they're available.
> 
> 2) Suggestion to authors / editors:
> 
> How about a summary appendix on optimizing your code for processing time
> and / or memory use? The one true holy tome has plenty of suggestions
> sprinkled throughout the book, but I'm looking for an organizational
> change, not a content change.
> 
> (Yeah, I know optimizing is a nebulous word, I used it purposely. I
> wouldn't want to limit suggestions to whatever my imagination can produce.)


if by 'truly holy tome' you are referring to the camel book then 
check out the section on efficiency:
in Camel 1: pp364-373
in Camel 2: pp537-546

tricks and hints for time efficiency and space efficiency are given
among others.

another useful source of information for time efficiency is using
the Benchmark.pm module.

hope it helps
regards
andrew


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

Date: Tue, 05 Aug 97 01:49:33 EST
From: MXD38@vm.cc.purdue.edu (Mark D)
Subject: editing files via cgi
Message-Id: <17BC119ADS86.MXD38@vm.cc.purdue.edu>

Problem: Data that I upload via HTML form is in wrong format.
 
Goal:  Write a CGI that reads in file A, reformats data in file A, saves as new
 file A.
 
How do I:  Write a cgi (PERL) that completes my goal.
 
Background on what I have done:
 
 -Wrote command line executable that works fine.  It uses '-npi'
compiling options.  That is:  #! usr/bin/perl -npi.  These options supported wh
en trying to run a cgi.  My current line executable program reads in values to
the perl variable: '$_' , reformats them and saves them to file.
 
Primary Dilemna:  The line executable program is run as follows...
 
'./prog.pl filename' ('filename' is the file to be reformated.)
 
 
With a CGI, I can't figure out how to tell the program which file to read in!
 
Any suggestions as to what I can try?  Mark
 
FYI Here is the line executible program I am trying to get to run as a cgi.
 
 
#!/usr/bin/perl -npi
#
 
BEGIN {
$_ = <>;
s/\r/\n/g;
$fields = tr/\t/\t/;
warn "fields: $fields\n";
 
print;
}
 
chomp;
undef $adjlast;
s/\r//g;
s/""/"/g;
while ($fields > tr/ / /) {
$_ .= "\t";
 
 
 
 
if(/\t"[^\t]+$/) {
$adjlast = 1;
}
s/\t"/\t/g;
s/"\t/\t/g;
s/"$// if defined $adjlast;
while ($fields > tr/ / /) {
$_ .= "\t";
warn "adding tab: line $.\n";
}
$_ .= "\n";
 
__END__
 


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

Date: 05 Aug 1997 10:54:11 -0400
From: Clark Dorman <clark@s3i.com>
Subject: Re: file extensions
Message-Id: <dzpqwllyk.fsf@s3i.com>


Simon Fairey <sfairey@adc.metrica.co.uk> writes:
> Shaun O'Shea wrote:
> 
> > I have an array whose elements are all file paths E.G.
> >
> >         address/of/the/file/in/question/file1.Uen.A.fmk
> >         address/of/the/file/in/question/file1.Uen.B.fmk
> >         address/of/the/file/in/question/file2.Uen.A.fmk
> >         address/of/the/file/in/question/file3.Uen.A.fmk
> >
> > I would like to use this array to create another array which just
> > contains the file extensions i.e.
> >                         .Uen.A.fmk
> >                         .Uen.B.fmk
> >                         .Uen.A.fmk
> >                         .Uen.A.fmk
> >
> > I tried to find some way to substitute everything up as far as the
> > first
> > "." with nothing but I couldn't.
> >
> 
[snip home grown solution]

Try using a module designed for this task:

#!/home/dorman/bin/perl -w

use File::Basename;

@files = ( 'address/of/the/file/in/question/file1.Uen.A.fmk',
           'address/of/the/file/in/question/file1.Uen.B.fmk',
           'address/of/the/file/in/question/file2.Uen.A.fmk',
           'address/of/the/file/in/question/file3.Uen.A.fmk' );

$name = '';
$path = '';

foreach( @files ) {
   ($name,$path,$suffix)=fileparse($_,'\..*');
   push @suffices, $suffix;
}

print join ("\n", @suffices), "\n";

-- 
Clark Dorman				"Evolution is cleverer than you are."
http://cns-web.bu.edu/pub/dorman/D.html                -Francis Crick


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

Date: 5 Aug 1997 01:56:44 GMT
From: mecran01@homer.louisville.edu (Mark E. Crane)
Subject: GROVEL: script that capitalizes unix filenames
Message-Id: <5s618s$a77$1@hermes.louisville.edu>

Hi, I'm just looking for a script that will auto-capitalize unix
filenames.  I've been moving between three platforms and the intermediate
server has munged things up dreadfully.

I thank you in advance!

M. Crane



 -- 
Honk if you love composition and rhetoric.



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

Date: Tue, 5 Aug 1997 13:01:16 GMT
From: Jacqui Caren <Jacqui.Caren@ig.co.uk>
Subject: Re: How to add users to .htpasswd
Message-Id: <EEFyu6.D84@ig.co.uk>

In article comp.lang.perl.misc:<5q02vt$4qd$1@cn1.hw.ac.uk>,
	andyc@ma.hw.ac.uk (Andy Crofts) writes:
>[Posted and mailed]
>
>In article <5p8hqb$9nc$1@news.socomm.net>,
>	"Vince Betro" <vinbetro@vantek.net> writes:
>> How do I add users and passwords to an .htpasswd file using the htpasswd
>> program?  I am using a PERL script on a UNIX server.
>> Jeff Betro
>> vinbetro@vantek.net
>I had a similar problem, as I was trying to creates a .htpasswd file from a text file.  The solution that my system administrator came up with was a unix program called 'expect' which os widely available.  It comes with an example script called autohtpasswd.
>
>Andy Crofts
>andyc@ma.hw.ac.uk

This is a little routine I use to regenerate a htpasswd file from
an large oracle RDBMS. Works OK with various versions of apache.
Modify to suit.

#!/usr/local/lib/perl -w
use Oraperl;
my $lda = ora_login('','username','password');
die $ora_errstr if $ora_errno;
my $csr = ora_open($lda, "select username, password from kbp_staff order by username ASC");
die $ora_errstr if $ora_errno;
open(PASS,">/tmp/passwd") || die;
while (($u,$p) = ora_fetch($csr)) {
        my $salt = substr($p, 0, 2);
        my $pass = crypt($p,$salt);
        print PASS "$u:$pass\n";
}
close(PASS);
die $ora_errstr if $ora_errno;

All the best,
	Jacqui
-- 
Jacqui Caren                    Email: Jacqui.Caren@ig.co.uk
Paul Ingram Group               Fax: +44 1483 419 419
140A High Street                Phone: +44 1483 424 424
Godalming GU7 1AB United Kingdom



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

Date: Mon, 4 Aug 1997 17:47:41 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Stephane Robertson <Stephane.Robertson@hec.ca>
Subject: Re: How-to cut the last characters of a varibles
Message-Id: <Pine.GSO.3.96.970804174716.12101L-100000@kelly.teleport.com>

On Mon, 4 Aug 1997, Stephane Robertson wrote:

> How can I cut the last characters of a variable? 

You probably want substr, documented in perlfunc(1). Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 4 Aug 1997 17:56:45 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Stephane Robertson <Stephane.Robertson@hec.ca>
Subject: Re: howto change variable to Variable
Message-Id: <Pine.GSO.3.96.970804175416.12101P-100000@kelly.teleport.com>

On Mon, 4 Aug 1997, Stephane Robertson wrote:

> How can we change the first character of a variable to upper case

There's a method in perlfunc(1). (Search for 'upper' or 'case'.) In fact,
you can probably find several ways to do this in the docs and FAQs. If you
have more Perl questions after you've read the docs and FAQs, please feel
free to post those questions here. Thanks! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 4 Aug 1997 17:46:29 -0700
From: trs@azstarnet.com (Tim  Smith)
Subject: Re: Inserting within a string?
Message-Id: <5s5t55$mr6@web.azstarnet.com>

In article <5s59gs$1og@fridge-nf0.shore.net>,
Nathan V. Patwardhan <nvp@shore.net> wrote:
>Burt Lewis (Burtlewis@ici.net) wrote:
>: I want to insert the letter x after the 5th a
>: new string: aaaaaxaaaaaaaaa

>Well, you could use substr(), like:
>$word = "aaaaaaaaaaaaaa"; 
>print substr($word, 0, 5)."x".substr($word, 6, length($word))."\n";

A very direct way is:

substr($word, 5, 0) = 'x';	# read the entry for substr in perlfunc
				# look for info about lvalues...

Tim



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

Date: 5 Aug 1997 08:11:06 GMT
From: jkekoni@cc.hut.fi (Joonas Timo Taavetti Kekoni)
Subject: IS there DBM Stuff containing
Message-Id: <5s6n6q$5oh$1@hiekkalaatikko.cs.hut.fi>

 IS there DBM Stuff containing perl Port for Win3.1/dos/WIN32S?

-- 
	_-  Joonas Kekoni       OH2MTF	    I                           -_
	_-internet:	jkekoni@cc.hut.fi   I       DO NOT EAT.         -_
	_-slowmail:	j{mer{ntaival 7a176 I                           -_
	_-		02150Espoo          I      It is a monitor      -_
	_-		Finland/Europe      I                           -_


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

Date: 04 Aug 1997 20:48:26 +0000
From: Tom Grydeland <tom@mitra.phys.uit.no>
Subject: JAPH (was: function pointer dereferencing)
Message-Id: <nqo7me1fzdx.fsf_-_@mitra.phys.uit.no>

pete@horus.cix.vapethis.co.uk (Pete Jordan) writes:

> Tom Grydeland <tom@mitra.phys.uit.no> obfuscated:

> > sub AUTOLOAD{print}map{$_->($_)}split//=>"Just another Perl hacker,";

> Nice one :)

I actually discovered that this is *two* characters too verbose:

sub AUTOLOAD{print}map{$_->()}split//=>"Just another Perl hacker,";

(AUTOLOAD never used its argument in the previous incantation)

> I /love/ this language...

Quite.  So do I.

The funny thing is, since I happened upon one of the previous
incarnations of the above JAPH, I've tried numerous other ways to
define a subroutine named q( ) or q(,).  All in vain.  Any takers?

> Pete Jordan

> "'Not twisted,' Salzy once said of her own
> passion, 'it is helical. That sounds better.'"

Indeed it does

-- 
//Tom Grydeland <Tom.Grydeland@phys.uit.no>


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

Date: Mon, 4 Aug 1997 17:43:31 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Tom Grydeland <tom@mitra.phys.uit.no>
Subject: Re: JAPH (was: function pointer dereferencing)
Message-Id: <Pine.GSO.3.96.970804174038.12101J-100000@kelly.teleport.com>

On 4 Aug 1997, Tom Grydeland wrote:

> I've tried numerous other ways to define
> a subroutine named q( ) or q(,).  

You'll have to use & (or something else special) to call it, since q// is
taken, as are m//, s///, and y///, as well as several with more than one
letter. Hope this helps! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 4 Aug 1997 17:54:04 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Tom Grydeland <tom@mitra.phys.uit.no>
Subject: Re: JAPH (was: function pointer dereferencing)
Message-Id: <Pine.GSO.3.96.970804175051.12101O-100000@kelly.teleport.com>

On Mon, 4 Aug 1997, Tom Phoenix wrote:

> On 4 Aug 1997, Tom Grydeland wrote:
> 
> > I've tried numerous other ways to define
> > a subroutine named q( ) or q(,).  
> 
> You'll have to use & (or something else special) to call it, since q// is
> taken, as are m//, s///, and y///, as well as several with more than one
> letter. Hope this helps! 

Hmmm... What I wrote was accurate, although now I see that you meant
something totally different than I thought. But Randal has posted a way to
do what you asked. So now maybe you'll be able to use this in next year's
Obfuscated Perl Contest!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 04 Aug 1997 16:56:23 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Tom Grydeland <tom@mitra.phys.uit.no>
Subject: Re: JAPH (was: function pointer dereferencing)
Message-Id: <8cu3h5tsd4.fsf@gadget.cscaper.com>

>>>>> "Tom" == Tom Grydeland <tom@mitra.phys.uit.no> writes:

Tom> The funny thing is, since I happened upon one of the previous
Tom> incarnations of the above JAPH, I've tried numerous other ways to
Tom> define a subroutine named q( ) or q(,).  All in vain.  Any takers?

*{" "} = sub { print "won't the traceback look neat?\n" };
*{","} = sub { print "and comma two!\n" };

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 392 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: 5 Aug 1997 10:00:44 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: JAPH (was: function pointer dereferencing)
Message-Id: <5s6tkc$g45@lyra.csx.cam.ac.uk>

Tom Grydeland  <tom@mitra.phys.uit.no> wrote:
>
>The funny thing is, since I happened upon one of the previous
>incarnations of the above JAPH, I've tried numerous other ways to
>define a subroutine named q( ) or q(,).  All in vain.  Any takers?

What's the problem?   Why not just do it:

    sub q { print "q here\n" };
    &{'q'};

prints as expected.

Or do you mean you want the subroutine to be named "q(,)" ?   AFAIK, you
have to use globs to get that.


Mike Guy


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

Date: 4 Aug 1997 17:36:23 -0700
From: trs@azstarnet.com (Tim  Smith)
Subject: Re: Please help re:  reg exp from command line...
Message-Id: <5s5si7$l0j@web.azstarnet.com>

In article <33D8C9E0.4FE6@atlanta.com>, Clark Polk  <clarkp@atlanta.com> wrote:
>This is what I want to do:
>	-From the command line search on a regular expression.. say
>	 diabetes.. in all of the .html's in the current directory.
>	-Once I find a match on the regular expression diabetes I want
>	 to print the name of the file AND the title name(sans </TITLE>)
>	 to STDOUT

I'll assume you're using a Unix system; if not ... I'm not sure what
the command line syntax would be.

I use the find program to print out the names of all the .html files,
then I run perl on those names, for example:

$ perl -e 'script line 1;' -e 'script line 2' `find . -name '*.html' -print`


You'll often want the -n switch to perl - it makes perl read through
all of the files named on the command line (so you don't have to
process @ARGV yourself).

Your request is a bit complicated - it might work better if you put the
program in a file, not just write it on the command line.  It's
certainly easier to modify that way.  If you insist on calling it from
the command line, you can just put each line of the file into its own
-e '...' flag.

This might get you started:

#!/usr/bin/perl -w
#
# I didn't test this code!
#

use strict;

# pass the regexp as the first arg to your program
my $pattern = shift;

# loop through the file names listed on command line
my $fname;
while ($fname = shift) {
    open FH, $fname or do { warn "can't open $fname: $!\n"; next; };
    
    my ($title, $found);
    while (<FH>) {
	# look for title and remember the title text
	m:<TITLE>(.*)</TITLE>:i and do {
	    $title = $1;
	    last if $found;
	};

	# look for pattern
	m:$pattern: and do {
	    $found = 1;
	    last if defined $title;
	};
    }

    close FH;

    if ($found) {
	print "$title ($fname)\n";
    }
}

exit 0;
__END__


If you've put this into a file called "findpattern" and put that file
into a directory in your PATH and made that file executable and
readable, then you could do from the command line:

$ findpattern '(?i)diabet(?:es|ic)' `find . -name '*.html' -print`

That would look for any file containing diabetes or diabetic, case
insensitive.

This might not be exactly what you want.  Hopefully it will get you
going.

Tim



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

Date: Mon, 4 Aug 1997 08:38:15 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Printing to absolute screen position
Message-Id: <adelton.870683895@aisa.fi.muni.cz>

Adam Naylor <NOSPAMadam@funnel.demon.co.uk> writes:

> Hi gurus,
> 
> I need to print to an absolute screen position from perl, so that I can
> update that same line with new information.
> 
> Example:
> 
> 12 of 100
> 13 of 100
> 14 of 100
> 
> .......but preferably overwriting the earlier print without calling
> 'clear'.

If you just need to write the status of your program (eg 12, 13, ...),
you might consider

$| = 1;
for (1 .. 20)
	{
	my $len = length $_;
	print $_;
	sleep 1;
	print "\b" x $len;
	}
__END__

or maybe

$| = 1;
for (1 .. 20)
        {
        print $_;
        sleep 1;
        print "\r";
        }
__END__

If your application is more complicated, try

	use Curses;

Hope this helps.

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
    European RC5 56 bit cracking effort -> http://www.cyberian.org/


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

Date: Tue, 05 Aug 1997 11:36:08 -0600
From: kennedycy@thecb.state.tx.us
Subject: Problems with Internet Explorer running a PERL script
Message-Id: <870798044.17351@dejanews.com>

Hello;

  I have written a program in Perl and have successfully tested it using
Netscape. However, when I use IE, after several operations, it flashes an
error message. Unfortunately, it flashes it too quickly for me to read.
   After this error message, IE locks up, requiring a Ctrl-Alt-Del to kill
the process.
   I appreciate any light you can shed on this.

Thanks,
Casey Kennedy
THECB

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Tue, 5 Aug 1997 00:47:39 GMT
From: bruce@evolution.com
Subject: Programmers Wanted For WebObjects & PERL Internet/Intranet Application Development
Message-Id: <970804204739.1218AADqE.bruce@deadlord>

Evolution Online Systems, one of New York's original Internet pioneers is
seeking candidates interested in joining our team of insanely clued
programmers.

We are nearing completion of a commercial Intranet product which is based on
a web application development and database access framework written entirely
in PERL and built inhouse over the past two years.  We also develop
applications using WebObjects and Enterprise Objects Framework, which are
NeXT/Apple's cutting edge development tools and frameworks.

We enjoy an excellent working environment, we only work on projects which
excite us and we've been in business for over 5 years, so we must be doing
something right.

Salary range is $50K to $90K depending on skills and experience.

If you have skills and experience with PERL, OpenStep/WebObjects, Objective-
C, C/C++, relational databases or UNIX systems administration and you'd like
to find out more about working at Evolution, please send a resume or
introductory letter to jobs@evolution.com, or call us at 212-843-5535.



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

Date: Tue, 05 Aug 1997 03:30:35 GMT
From: reply to  ari  @  imaristudios  .  com (Ari Burton)
Subject: PROGRAMMERS WANTED
Message-Id: <33e69e53.21393343@news.theonramp.net>

****NOTICE****** To reply to this message,
DO NOT HIT REPLY! Instead send E-Mail to

ari  @   imaristudios   .  com

(Remove the spaces)


POSITIONS AVAILABLE:

POSITION #1.:

CGI/PERL/JAVA/C programmer(s) wanted.

CGI/PERL scripts will be used on
UNIX servers.

Shockwave experience a plus.

Real Audio experience a plus.

Please send resume with your E-Mail.
Do NOT be concerned if you have never been
hired professionally before.

Our main interest is that you are GOOD in what
you do, and you take pride in your work.

==============================================

If you are interested in these positions, please
contact Ari Burton, President of IMARI STUDIOS at

ari  @  imaristusios  .  com

(REMOVE THE SAPCES...I had to enter my mail address
like that to avoid the dreaded spam E-Mail bots that
scan these news groups collecting addresses to spam.)

Thank you
IMARI STUDIOS
http://www.imaristudios.com


Warmest regards,
Ari Burton, President of
I M A R I   STUDIOS
http://www.imaristudios.com
ari@imaristudios.com
or
ari@tfj.com


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

Date: Tue, 5 Aug 1997 16:47:53 +0100
From: Jerry Pank <jerryp.usenet@SPAMconnected.demon.co.uk>
Subject: Running Perl under Windows - No NFS
Message-Id: <t47bZGAps05zEw72@connected.demon.co.uk>

Newbie question, ploughed thru loads of FAQs - Still confused!

In order to get to speed quickly I need to be able to test my scripts -
initially more for simple sytax checking than anything else - locally on
a PC (W95 pref) before FTPing/testing/failing_for_stupid_reasons !

Whilst I don't expect the cgi stuff to run I guess there must be some
form of emulator about.  Everything I can find from CPAN assumes (I
think) that the system will be /live/ or running as a NFS.

Does such an aminal exist and where does it live?
-- 
Jerry           jerryp dot usenet at connected dot demon dot co dot uk

Warning - Clean out the spam filter.


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

Date: Mon, 4 Aug 1997 21:30:14 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: qnainfo@mindspring.com
Subject: Re: Saving the state of a form from invocation to invocation
Message-Id: <Pine.GSO.3.96.970804212837.9341G-100000@kelly.teleport.com>

On Mon, 4 Aug 1997 qnainfo@mindspring.com wrote:

> Is there a cgi script in Perl that will allow me to pass information on
> a form from page to page each time the order form is accessed until it
> is filled out with the collected information? 

Yes. In fact, it's easy to write when you use CGI.pm, which is probably
also the best way to do it. (Unless, of course, you want to use one of the
many pre-written scripts and modules which may do what you need.) 

> Do you know of anyone I can contact that will incorporate the necessary
> scripts into my web pages for a reasonable price? 

Yes, for sufficiently large values of "reasonable". :-)

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 04 Aug 1997 14:47:15 +0200
From: Patrick Sibenaler <patrick@arch.ethz.ch>
Subject: searching (ms)troff2html
Message-Id: <33E5CF53.41C6@arch.ethz.ch>

Hi list,


Does anyone know about a simple troff 2 html converter 
that processes ms macros?

there are a multitude around, but most support only me 
tags....

greets, 
   patrick./

ps:  please cc to patrick@arch.ethz.ch
ps2: perl still rules!



---------------------------------------------------------------------------
The trick is to communicate bi-directional in real time and high
resolution
---------------------------------------------------------------------------


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

Date: 4 Aug 1997 17:56:14 -0700
From: trs@azstarnet.com (Tim  Smith)
Subject: Re: Simple perl question
Message-Id: <5s5tne$oe0@web.azstarnet.com>

In article <5s5gtp$1oj@sashimi.wwa.com>,
Shriram Venkatraman <shriramv@sashimi.wwa.com> wrote:
> I tried open (FILEHANDLE, "+> $filename") and it truncated filename to 0;
> so now, I cant read from it.

You want '+<', not '+>'.  It'll make sense after you use it.

Tim



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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.  

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

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