[7631] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1257 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 31 21:07:11 1997

Date: Fri, 31 Oct 97 18:00:26 -0800
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, 31 Oct 1997     Volume: 8 Number: 1257

Today's topics:
     Re: [repost] File handle attached to a function? (Lloyd Zusman)
     Re: Accessing perl libraries (Jason Gloudon)
     Re: again -- multi-line text replacement (Bill Moseley)
     Re: again -- multi-line text replacement <rootbeer@teleport.com>
     Re: if (0<= $hun < 250) doesn't compile (Peter Samuelson)
     looking for directory utility to use in browser <rauc@capgroup.com>
     Need Perl Advertisement Script that runs on NT/IIS 3.0 (Eric Phillips)
     Need Perl Advertisement Script the runs on NT/IIS3.0 (Eric Phillips)
     Need starting help <Amythest@jps.net>
     Re: Need starting help <rootbeer@teleport.com>
     Re: New version when? (Jason Gloudon)
     Novell and CGI <jfuhring@platinum.com>
     oraperl <knguyen@ab.bluecross.ca>
     Re: Perl 5.003? Anybody got the tar.gz? <rootbeer@teleport.com>
     Perl aborts executing a program under a differend Uid (Fred Elbel)
     Re: Perl Format Command (Tad McClellan)
     Re: Perl Format Command <gnew@southernvirginia.edu>
     persistence problems using DB_File and MLDBM gtuckerkellogg@genetics.com
     Re: please help--reding client file from a server (Tad McClellan)
     programmer needed <racioppi@ptd.net>
     Re: Reading from bottom, or writing to top of file <joegottman@worldnet.att.net>
     Re: Regex: finding the n'th pattern in a string. Global (Tad McClellan)
     Re: Telling Whether a Wildcarded Regular Expression Wil (Peter Samuelson)
     text/html [was Newbie Q...] (Peter Samuelson)
     The Gecko Book (Learning Perl on Win32 Systems) <camerond@mail.uca.edu>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 1 Nov 1997 00:24:22 GMT
From: ljz@asfast.com (Lloyd Zusman)
Subject: Re: [repost] File handle attached to a function?
Message-Id: <slrn65kth4.f4.ljz@ljz.asfast.net>

On Fri, 31 Oct 1997 07:58:00 -0800, Tom Phoenix <rootbeer@teleport.com> wrote:
> On 31 Oct 1997, Lloyd Zusman wrote:
> 
> > Given some of the newer file-handle functionality in Perl, is it
> > possible to somehow attach a file handle to a function, 
> 
> You can do something like that with a tied filehandle in 5.004. It's new
> functionality, though, and you're likely to discover the bugs when you use
> it. :-) 

Yes, this is exactly what I'm looking for.  I investigated this, and
it works fine as long as I'm using print, printf, getc, read, and
readline (<>).  But what about write?  Is there a plan to have a WRITE
method underneath a FILEHANDLE class any time soon?  Since we have
READ, it seems symmetrical to also have WRITE.  And it so happens that
I have a use for WRITE right now.

Also, I want to take this opportunity to publicly express my thanks
for the other help I also received in response to my query.


-- 
 Lloyd Zusman
 ljz@asfast.com


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

Date: 1 Nov 1997 01:37:54 GMT
From: bash@bbn.remove.com (Jason Gloudon)
Subject: Re: Accessing perl libraries
Message-Id: <63e15i$emd$1@daily.bbnplanet.com>

Colin Forde (c.forde@qub.ac.uk) wrote:
: ##  How do you get the PERL libraries?  Probably -lperl -lm, blank if no
: PERL
: #### =()<PERL_LIB       @<PERL_LIB>@>()=
: PERL_LIB        -L/usr/local/lib/perl5/sun4-solaris/5.00403/CORE -lperl
: -lm

: -L/usr/local/lib/perl5/sun4-solaris/5.00403/CORE -lperl -lm -lsocket
: -lnsl -lelf -lresolv

Inn wants to link with a libperl.a or libperl.so library, which it is looking
for in /usr/local/lib/perl5/sun4-solaris/5.00403/CORE. By default, the perl
install doesn't install or create them. You'll need to get the perl source 
and build them.

Jason Gloudon


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

Date: 31 Oct 1997 23:10:34 GMT
From: moseley@netcom.com (Bill Moseley)
Subject: Re: again -- multi-line text replacement
Message-Id: <63doha$get$1@nnrp2.snfc21.pbi.net>

I spoke a bit too soon.  I need to find a way to stop a pattern match at the 
FIRST occurance of the match.

When doing a block replacement with:


>s/STARTSTRING.*ENDSTRING/replace string/s; # /s so that . matches \n

is there a way to say match just upto the first occurence of "ENDSTRING"?  As 
it is right now, (and rightly so) it matches everything up to the *last* 
ENDSTRING in my file.

I tried

   s/STARTSTRING.*(ENDSTRING){1,1}/replace string/s

but that didn't work.  That obviously matches just one "ENDSTRING".

To be more specific, I'm bulk editing a bunch of html documents.  I'm trying to 
replace text withing the first column of a table, but just from a given point 
within that column.

I'm using:

  s/<img src="(\.\.\/)*images\/minisail\.gif.*(<\/TD>)/$NEWSTR/si;

on the following example table that just has two columns.

<TABLE>
  <TR>
    <TD>
       some text that I want to keep.

       Text below here to the end of THIS column should be replaced.
       <img src="../images\/minisail\.gif............
       replace everything down to the first </TD>
       .........
    </TD>

    <TD>
       All this text stays here
    </TD>?
  </TR>
</TABLE>


Any suggestions?


-- 
Bill Moseley
mailto:moseley@netcom.com



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

Date: Fri, 31 Oct 1997 17:02:21 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Bill Moseley <moseley@netcom.com>
Subject: Re: again -- multi-line text replacement
Message-Id: <Pine.GSO.3.96.971031170112.9456G-100000@usertest.teleport.com>

On 31 Oct 1997, Bill Moseley wrote:

> When doing a block replacement with:
> 
> >s/STARTSTRING.*ENDSTRING/replace string/s; # /s so that . matches \n
> 
> is there a way to say match just upto the first occurence of
> "ENDSTRING"?

Do you find anything useful when you search for the word "greedy" in the
perlre(1) manpage? 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/
              Ask me about Perl trainings!



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

Date: 31 Oct 1997 17:51:13 -0600
From: psamuels@sampo.creighton.edu (Peter Samuelson)
Subject: Re: if (0<= $hun < 250) doesn't compile
Message-Id: <63dqth$4ck$1@sampo.creighton.edu>

[l. trindle gennari <gennari@slac.stanford.edu>]
> if ((0 <= $hun) && ($hun < 250))

  if (0 <= $hun and $hun < 250)

Some disagree, but I think fewer parens correlates with more readable.
And though some will argue that && has lower precedence than <= and <
anyway, I'd still use "and" instead, since that way someone reading or
debugging won't have to be suspicious and check the precedence order
later.  Besides, using "and" acts as a "require 5.000" statement, thus
saving one line.... (:

--
Peter Samuelson
<psamuels@sampo.creighton.edu>


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

Date: Tue, 28 Oct 1997 14:42:53 -0800
From: "Raul L. Chiriboga, Jr." <rauc@capgroup.com>
Subject: looking for directory utility to use in browser
Message-Id: <34566A6D.CA8234CF@capgroup.com>

I am looking for a perl script that will generate a listing of files to
be used with a browser.  I think that the default index.html is too
ugly.  Has someone written a better one? Any pointers?

Thanks.
rauc@capgroup.com



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

Date: Fri, 31 Oct 1997 03:09:34 GMT
From: e.phillips@mindspring.com (Eric Phillips)
Subject: Need Perl Advertisement Script that runs on NT/IIS 3.0
Message-Id: <34594b27.15976054@news.mindspring.com>

Hello all, I am in serious need of a Perl script that does the
following:

Display a banner, either random or weighted, with the link.

Also, a Web Management system that I can do through Netscape.  

A Non-SSI approach would be nice, but if it HAS to have SSI, it's ok.


Also, will and can run
under the following OS:

WIN NT
IIS3.0
Latest version of Perl

PLEASE someone let me know if they find one!!!


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

Date: Fri, 31 Oct 1997 02:53:38 GMT
From: e.phillips@mindspring.com (Eric Phillips)
Subject: Need Perl Advertisement Script the runs on NT/IIS3.0
Message-Id: <345947ae.15087569@news.mindspring.com>

Hello all, I am in serious need of a Perl script that will and can run
under the following OS:

WIN NT
IIS3.0
Latest version of Perl

PLEASE someone let me know if they find one!!!


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

Date: Fri, 31 Oct 1997 16:32:23 -0800
From: Amy <Amythest@jps.net>
Subject: Need starting help
Message-Id: <345A7896.18B8@jps.net>

Hello.

I can't seem to get to first base.

I downloaded (via http) the 312 build from ActiveState.  Ran the
execute file.  Watched the installer work.  Shut the computer down,
and restarted.  Made a shortcut to Perl.  All that worked fine.

Then I tried  to get the verson with the -v command.  I get a message
that says: Unrecognized file test: -v at - line 1.  and then it shuts
the Perl window down.  Did I mention I'm in Win95?  It doesn't 
recognize -e commands either.  I am just a bit frustrated.

I did try re-doing it, but got the same result.  Twice.

Can anybody tell me what to do now?

Thanks....

Amy <amythest@jps.net>


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

Date: Fri, 31 Oct 1997 17:05:14 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Amy <Amythest@jps.net>
Subject: Re: Need starting help
Message-Id: <Pine.GSO.3.96.971031170321.9456H-100000@usertest.teleport.com>

On Fri, 31 Oct 1997, Amy wrote:

> Then I tried  to get the verson with the -v command.  I get a message
> that says: Unrecognized file test: -v at - line 1. 

That's because -v is not a command; it's an invocation option. Try
something like this, from the command line (not within a script). 

    perl -v

You may need to give the full path to perl on the command line, if it's
not found along your current path. See the perlrun(1) manpage for more
info. Good luck!

-- 
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/
              Ask me about Perl trainings!



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

Date: 1 Nov 1997 01:46:50 GMT
From: bash@bbn.remove.com (Jason Gloudon)
Subject: Re: New version when?
Message-Id: <63e1ma$emd$2@daily.bbnplanet.com>

Casper K. Clausen (ckc@dmi.min.dk) wrote:
: Hi all.

: I'm contemplating installing 5.004_3 on our system. However, we do not
: currently use Perl in any way which an upgrade from our 5.002 version
: would impact.

: Thus my question is:

: Is a new release imminent (imminent meaning 'coming out within a month
: or thereabouts')?

: I would feel pretty stupid installing 5.004_3 if _4 or .005 came out a
: couple of weeks later.

I just saw something on comp.lang.perl.announce that you might want to 
look for concerning this. See the group does have a purpose. More people
really should pay attention to it.
There is a _4 available. Oddly enough i happened to install it before the 
announcement got to me.

This is perl, version 5.004_04 built for i86pc-solaris

Copyright 1987-1997, Larry Wall


Jason Gloudon


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

Date: Fri, 31 Oct 1997 16:18:28 -0800
From: Jim Fuhring <jfuhring@platinum.com>
Subject: Novell and CGI
Message-Id: <345A7554.B581DB9E@platinum.com>

Has anyone had any experience with using a Novell Web server. I am
trying to run a Perl5 script. It seems from the documentation that I
have read so far, that the server has to be set up to run a Perl script.
I am new to Perl and CGI programming, but am learning fast....too fast.
Does anyone know how to set up a Novell Web Server?

Jim Fuhring
jfuhring@platinum.com



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

Date: Fri, 31 Oct 1997 16:19:40 -0700
From: Ky Nguyen <knguyen@ab.bluecross.ca>
Subject: oraperl
Message-Id: <345A678C.1DC4@ab.bluecross.ca>

Hi all,

Could someone using oraperl please tell me how to connect
to an oracle sid that is not on the same box with the one
the script is executed from?

If I have oracle sid DB1 on HOSTA, and if my perl script is on
HOSTB, what should be the parameters for my &ora_login cmd?

Thanks in advance!
-- 
        ''~``
       ( o o )
+-.oooO--(_)--Oooo.-----------------------------------+
| Light travels faster than sound. This is why some   |
|  people appear bright until you hear them speak.    |
|   .oooO                                             |
|   (   )   Oooo.                                     |
+----\ (----(   )-------------------------------------+
      \_)    ) /
            (_/


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

Date: Fri, 31 Oct 1997 14:42:10 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: brian <bgannon@purdue.edu>
Subject: Re: Perl 5.003? Anybody got the tar.gz?
Message-Id: <Pine.GSO.3.96.971031143850.9456D-100000@usertest.teleport.com>

On Fri, 31 Oct 1997, brian wrote:

> I have a program that needs Perl 5.003.. I tried it with 5.004_01 with
> no avail..  (even tried 5.004_04) anyway... 

Rather than install 5.003, you'd (almost certainly) be better off
installing 5.004. There are very _very_ few good, working 5.003 scripts
which fail under 5.004 - but it's not hard to make a bad script which
5.003 didn't recognize was bad. :-) 

If you have trouble figuring out how to fix it up, see about reducing the
problems to small sections (say, a dozen lines or less) which show the
problem behavior, then post those here. Good luck!

-- 
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/
              Ask me about Perl trainings!



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

Date: Sat, 01 Nov 1997 01:42:00 GMT
From: frelbel@csnN0SPAM.net (Fred Elbel)
Subject: Perl aborts executing a program under a differend Uid
Message-Id: <345a8821.1398449@news-2.csn.net>


Summary:

Executing a perl program with the setuid bit (chmod 4755) set causes
Perl 5.003 to abort when executing the program from a different
directory.

Perl aborts with the following message:

YOU HAVEN'T DISABLED SET-ID SCRIPTS IN THE KERNEL YET!
FIX YOUR KERNEL, PUT A C WRAPPER AROUND THIS SCRIPT, OR USE -u AND
UNDUMP!

This error message is documented on p 597 of the Perl5 camel book.


Details:

Running under HP-UX B.10.01, I have my own print spooler interface
utility in /etc/lp/interface.  This runs as user lp, but needs to call
a program in another user directory and run as that user in order to
write files to that user's directory.  The idea is that the spooler
captures information from a specific print spool and directs the data
to a specific application.

I set the set user ID bit of the application program: In directory
/u/appl, logged on as the user, I issued and verified chmod 4755
myappl.pl.

I then sudo-ed to lp and tried to run the application:
/u/appl/myappl.pl.
Perl aborts with the error message shown above.

Anyone have any ideas on this?
a)  how to avoid/fix the perl problem
b)  another way to execute a perl script in another user's directory
as that user?

Thanks much,
Fred Elbel
--  Fred Elbel  frelbel@N0SPAMcsn.net
--    To e-mail: delete N0SPAM in my return address 


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

Date: Fri, 31 Oct 1997 16:34:54 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Perl Format Command
Message-Id: <eemd36.3h1.ln@localhost>

Gary C. New (gnew@southernvirginia.edu) wrote:
: I've looked and looked and looked for examples and faq's for perl's
: format command 


Good, so then you have already had a look at the perlform (Perl formats)
man page that is included in the perl distribution.


: (I have a perl manuel).  

Is that the porter of the Spanish version of perl?  ;-)


Some "manuals" are good.

Some are less than good.

Which one do you have (besides the man pages that you already have,
                       since I assume you have a proper perl installation)?


: I still don't completely
: understand how to implament it 


If you can phrase a question, someone will likely take a stab at
answering it.


: especially with regards to cgi and

That would be a different newsgroup.

This is the Perl newsgroup. Stuff particular to the CGI environment
is discussed in the CGI newsgroup:    comp.infosystems.www.authoring.cgi


: printing to MAIL file handle.

: Can anyone direct me to an indepth review of the format command and how


What are you trying to get that you cannot figure out from the info
in perlform?

Is there some part of that man page that is unclear?

Maybe we can explain it better if you share with us what part you
don't understand...


: to get the output to remain the same after sending it through MAIL.

That would depend on what program is connected to the file handle.

That too would be a different newsgroup.

This is the Perl newsgroup. There are several newsgroups where asking
questions about mail programs would be appropriate. This is not one
of them ;-)



--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: Fri, 31 Oct 1997 19:07:50 -0500
From: "Gary C. New" <gnew@southernvirginia.edu>
Subject: Re: Perl Format Command
Message-Id: <345A72D6.5D9C@southernvirginia.edu>

Tad McClellan wrote:
> 
> Gary C. New (gnew@southernvirginia.edu) wrote:
> : I've looked and looked and looked for examples and faq's for perl's
> : format command
> 
> Good, so then you have already had a look at the perlform (Perl formats)
> man page that is included in the perl distribution.

Yes, I have...  Very much so.

> : (I have a perl manuel).
> 
> Is that the porter of the Spanish version of perl?  ;-)
> 
> Some "manuals" are good.
> 
> Some are less than good.
> 
> Which one do you have (besides the man pages that you already have,
>                        since I assume you have a proper perl installation)?

I have "Using PERL 5 by David Harlan, Shelley Powers, Paul Doyle, and
Micheal O Foghlu".

> : I still don't completely
> : understand how to implament it
> 
> If you can phrase a question, someone will likely take a stab at
> answering it.

>From the perlform I understand the major pic and variable setup, but
what it doesn't explain very well is where it goes after after writing
it.  I would assume it's in the format File Handle, but when I try to
print it to the screen it is the same old, same old.

> : especially with regards to cgi and
> 
> That would be a different newsgroup.
> 
> This is the Perl newsgroup. Stuff particular to the CGI environment
> is discussed in the CGI newsgroup:    comp.infosystems.www.authoring.cgi

Thank you for that useful bit of info.  I'll remember that.

> : printing to MAIL file handle.
> 
> : Can anyone direct me to an indepth review of the format command and how
> 
> What are you trying to get that you cannot figure out from the info
> in perlform?

How can I extract it to print on the screen or another file handle?

> Is there some part of that man page that is unclear?

After format HANDLE
      @<<<<<<<<<<<<
      $var{'varible'}
      .
the period.

> Maybe we can explain it better if you share with us what part you
> don't understand...
> 
> : to get the output to remain the same after sending it through MAIL.
> 
> That would depend on what program is connected to the file handle.
> 
> That too would be a different newsgroup.
> 
> This is the Perl newsgroup. There are several newsgroups where asking
> questions about mail programs would be appropriate. This is not one
> of them ;-)
> 
> --
>     Tad McClellan                          SGML Consulting
>     tadmc@flash.net                        Perl programming
>     Fort Worth, Texas

Thank you for the tackful information and willingness to address my off
and on inqueary for over a year now.

gnew@southernvirginia.edu


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

Date: Fri, 31 Oct 1997 19:01:49 -0600
From: gtuckerkellogg@genetics.com
Subject: persistence problems using DB_File and MLDBM
Message-Id: <878345689.17581@dejanews.com>

This is a weird situation, but I'm hoping that I've overlooked a simple
answer.

I have a bunch of objects stored in a hash tied to a DB_File via
MLDBM, but they keep getting "lost".  By that I mean if I *know*
the name of the key, I can get the value, but not all the keys
show in "keys %tiedhash".

Some simple code below demonstrates the problem.  In it, I just copy the
members of one tied hash to another, and then find that the number of
keys aren't the same.  When run, it produces the following output:

140 keys in Project.DB
0 keys in New.DB to start
140 keys in New.DB when built
13 keys in New.DB when reopened
J00127
J00128
J02908
J05213
L10347
L10349
L13616
M32313
M81104
U37022
U37028
U95299
X68452
ProbeSet=HASH(0x1400415b8)

Here's the code:

#!/usr2/local/bin/perl -w

use lib qw(/usr2/users/gtk/lib/perl5);

use strict;
use Carp;
use Data::Dumper;
use DB_File;
use MLDBM;
$MLDBM::UseDB = 'DB_File';

# %STARTLIST contains a bunch of objects that I've
# placed before.  Just open this puppy up.

my ($startlist,%STARTLIST);

$startlist = tie (%STARTLIST,'MLDBM',"Project.DB",
                O_RDWR,0664,$DB_HASH) or croak $!;


print (scalar keys %STARTLIST, " keys in Project.DB\n");

# Now copy the elements into %NEWLIST, which should be a new
# file.

my %NEWLIST;
my $newlist;

$newlist = tie (%NEWLIST,'MLDBM',"New.DB",
                O_RDWR | O_CREAT,0664,$DB_HASH) or croak $!;

print (scalar keys %NEWLIST, " keys in New.DB to start\n");  # This
should be zero

my $name;
foreach $name (sort keys %STARTLIST) {
  $NEWLIST{$name} = $STARTLIST{$name};
  $newlist->sync;  # for good measure, apparently makes no difference
}

print (scalar keys %NEWLIST, " keys in New.DB when built\n");

# This should be equal to the number of keys in %STARTLIST;

undef $newlist;
untie %NEWLIST;
undef %NEWLIST;

my %CHECKLIST;   # This will be identical to %NEWLIST, right?
my $checklist;

$checklist  = tie (%CHECKLIST,'MLDBM',"New.DB",
                O_RDWR,0664,$DB_HASH) or croak $!;

print (scalar keys %CHECKLIST, " keys in New.DB when reopened\n");

print join("\n",sort keys %CHECKLIST), "\n";

if (defined $CHECKLIST{'U49844'}) { print $CHECKLIST{'U49844'}, "\n"; }

# Huh?  Why should this be defined if it isn't found in
# keys(%CHECKLIST)?

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


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

Date: Fri, 31 Oct 1997 14:22:22 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: please help--reding client file from a server
Message-Id: <uled36.d21.ln@localhost>

Lena Mindlina (mindlina@allegro.cs.tufts.edu) wrote:
: Hello,

Hi.

: this is the first time I am posting here...and already asking for help(-:
: Thanks in advance to everyone answering this.

: I am writing a cgi script in perl. Among other things, it needs 
                 ^^^^^^^^^^

CGI scripts run on the server.


: to read into a string information from a file that is on the client's pc. 
: Now, this is relatively easy to do if I upload the file to the server, then
: read from it and then clean up. However, I really don't want to upload
: the file. Is it at all possible to have a form asking user for the
: file to look in, but then instead of uploading the file, read the 
: information from it into a variable? 

: I'd appreciate any help on this...


Think about that for a minute.

 ...


"I really don't want to upload the file"

and

"read the information from it into a variable"


Where will the variable live?

On the server, since that is where the CGI script runs...

You end up transferring the whole thing either way.



Why do you not want to upload the file?

To save disk space? You wouldn't save any bandwidth...


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: Fri, 31 Oct 1997 18:05:48 -0500
From: Randy <racioppi@ptd.net>
Subject: programmer needed
Message-Id: <345A644C.444F@ptd.net>

I have some scripts that are working fine, but I need to alter them a
bit to perform some functions that don't presently perform.  Anyone who
is interested in some freelance work, drop me an email and let me know. 
It is probably only a few hours of work for someone who is a lot more
familiar with Perl than me.  If interested, send me your telephone
number and the best time to reach you so I can contact you to explain
the types of things I need done.


Thanks,

Randy


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

Date: Fri, 31 Oct 1997 19:16:03 -0500
From: Joe Gottman <joegottman@worldnet.att.net>
Subject: Re: Reading from bottom, or writing to top of file
Message-Id: <345A74C3.378D@worldnet.att.net>

COWBYS wrote:
> 
> I have a form which outputs one line records, (followed by a newline), to a
>  text file each time the form is submitted
> (the file is appended using ">>" with the file handle).
> What I am doing is reading thru this file later (using seek and read), and
>  producing an HTML table
> which consists of one row of info for each one line record.
> 
> Obviously, doing it the way I am, I write to the bottom of the file (append it)
>  each time I write a new record to it, and I read the file starting from the
>  top. My problem is that because i am reading from the top of the file, the
>  most recent entries from the form that have been appended to this file, are at
>  the bottom, and therefore information is displayed in my HTML table as oldest
>  data first (from the top).
> 
> I want to be able to display the newest data in the file first, either by
>  reading  from the bottom of my text file up ( not from the end of the file,
>  using seek, but from the beginning of the last record).
> 
> or, if possible, i would prefer the following:
> 
> when I output my records to my text file, i want to be able to write the newest
>  records to the top of the file, so when I read it later, the newest records
>  are at the top of the page. I tried using "+<" with my file handle instead,
>  but it works once, writing to the top of the file, and then the second time i
>  sbmit a form, it relaces the first line that it wrote previously....
> 
> any advice appreciated.... TIA    DCF (cowbys@aol.com)

   How big is your text file? If it is small enough to fit completely
into memory,
you can just read the whole thing into an array, then read the array
from bottom to
top. The command to put the whole file into an array is just
    @lines = <INPUT>;

  Then close your file for input, and read from the back. Keep the
records you want
to add in a new array, called @added. Then, when you reopen your file to
output, just
print OUTPUT @added; #print new lines.
print OUTPUT @lines; #print old lines.
    

-- 
Joe Gottman
joegottman@nospam.worldnet.att.net

[Remove nospam to reply]


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

Date: Fri, 31 Oct 1997 14:15:59 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Regex: finding the n'th pattern in a string. Global matching using while and foreach
Message-Id: <v9ed36.t11.ln@localhost>

gtuckerkellogg@genetics.com wrote:
: My quandry boils down to this: under what circumstances should the first
: block shown below succeed and the second block fail?

[ snip code and output ]

: , that is, the foreach loop fails to succeed in the match.  In addition,
: I'm getting errors of the type

: "Use of uninitialized value at (eval 22) line 18."
                                  ^^^^^^^
                                  ^^^^^^^
perl is warning about line 18 in the 22nd eval() of your script,
not line 18 of your script.


: but line 18 is just "$| = 1".

: Any thoughts?  What could cause this foreach loop to fail?


check out each of your calls to eval()


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: 31 Oct 1997 17:29:19 -0600
From: psamuels@sampo.creighton.edu (Peter Samuelson)
Subject: Re: Telling Whether a Wildcarded Regular Expression Will Match Any Files
Message-Id: <63dpkf$3t0$1@sampo.creighton.edu>
Keywords: wildcard match

[Kevin M Simonson <simonsen_nospam@skopen.dseg.ti.com>]
>      I have just written a "perl" script that does a bunch of
> processing on a bunch of files that are determined by an argument
> passed in on the command line.  In order to process all the files I
> need to process, I do an "ls" on a pathname that has a few rigidly
> defined parts, includes the argument passed in, and also includes
> Unix wildcards.

Do you mean that a wildcard was passed in on the command line?  If so,
make sure you understand how Unix shells deal with wildcards.  They
expand them in place, and pass the several filenames to your script
separately.  Meaning, you don't have a chance to handle the wildcard
directly (unless you operate like the find command's -name argument,
which parses globs by making you quote them to the shell).  Different
shells also do different things with regard to a wildcard that doesn't
match anything -- some just pass in the wildcard unchanged and some
complain and refuse to run the command line at all.  Nothing you can do
about the latter case, except make your users quote the wildcard, then
handle it yourself.

>      It has just dawned on me that if the user enters an erroneous
> argument, the "ls" command executed on the mixture of regular
> characters and wildcards might not find a match.

Others on this thread have already posted how to use globbing from
within Perl, rather than explicitly calling "ls" to do it.  It's worth
noting that even if you want to use the approach you are using, you
probably want to use "echo" rather than "ls", since it's usually a
shell built-in so you'll be creating one external process instead of
two.  (This is not far from how perl implements globbing anyway.)

--
Peter Samuelson
<psamuels@sampo.creighton.edu>


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

Date: 31 Oct 1997 17:16:18 -0600
From: psamuels@sampo.creighton.edu (Peter Samuelson)
Subject: text/html [was Newbie Q...]
Message-Id: <63dos2$30l$1@sampo.creighton.edu>

[Justin Wills  <justin@nectar.com.au>]
> Content-Type: multipart/alternative [...]
> Content-Type: text/plain; charset=us-ascii
> Content-Type: text/html; charset=us-ascii

Please configure your "newsreader" to use what Usenet has always used:
text/plain.  MIME types are cool for things like binary data that you
can't cleanly represent in text (though uuencode is a nifty hack that
has worked well for a long time) but writing a simple post in HTML is
unnecessary, and including a copy in plain text wastes space.  Usenet
has survived for many years without the visible need for multiple
fonts, animated advertizing GIFs and blinking text.  Maybe the regulars
of alt.fan.warlords appreciate the Mozilla 4.02 style, but I (speaking,
I hope, for at least some in c.l.p.m) do not.

--
Peter Samuelson
<psamuels@sampo.creighton.edu>


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

Date: Fri, 31 Oct 1997 15:46:46 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: The Gecko Book (Learning Perl on Win32 Systems)
Message-Id: <345A51C6.D0819DFA@mail.uca.edu>

Good afternoon, all,

A couple of weeks ago, I said I would comment on the Gecko book from the
standpoint of one who really needs it, not an expert. Well, IMHO, it is
a fine book to learn perl from. I haven't finished it yet (darn day job
keeps getting in the way), but have gotten most of the way through. The
book is an easy read, the explanations are clear, good exercises are at
the end of each chapter and "Here's one way to do it" answers are
provided with explanations. 

I would have only liked to see two minor changes: (1) another short
appendix, listing the meanings of the Special Variables (the $whatevers)
that are used in the book, since as it is you have to search for them
through the index; and (2) a typeface for the program code with a more
distinguishing {} symbol, since with my eyesight getting not so good, I
mistook them for () too many times. 

All in all, I would highly recommend this book to any other aspiring
perl newbie who needs/wants to use Win32 (95 or NT). It is really a
bargain, if you value your time to be worth anything at all. Now, where
are those specs?

Cameron
camerond@mail.uca.edu


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

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

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