[7728] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1354 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 21 11:17:32 1997

Date: Fri, 21 Nov 97 08:00:28 -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, 21 Nov 1997     Volume: 8 Number: 1354

Today's topics:
     Re: -w flag (Tad McClellan)
     Re: -w flag <zenin@best.com>
     Re: -w flag (I R A Aggie)
     Re: 2 Dimensional Arrays - how? (Jay Flaherty)
     A3 Perl Compiler <robert.crooks@NoSpamnortel.ca>
     Re: Can Perl dial the phone? <jim.michael@gecm.com>
     Re: Copy files (I R A Aggie)
     Re: DBM-speed (Mike Heins)
     Re: Downcase/Upcase <accu-scan@worldnet.att.net>
     Re: File attachments using sendmail <jamesr@aethos.co.uk.nospam>
     Re: File attachments using sendmail <jamesr@aethos.co.uk.nospam>
     Re: giving up on flock (Tad McClellan)
     Re: giving up on flock <tchrist@mox.perl.com>
     Heeelp! <beetle@reksoft.ru>
     How to select from 12 step-two forms? (Dave Reed)
     OUTPUT of images and uploading <chris@starkimages.com>
     OUTPUT of images and uploading <chris@starkimages.com>
     Page turner <kjb@biplane.com>
     Re: Page turner <zenin@best.com>
     passing more than 1 variable in a href <atloto7@nbnet.nb.a>
     Re: passing more than 1 variable in a href (Honza Pazdziora)
     Re: passing more than 1 variable in a href <zenin@best.com>
     PERL Hourly Rates <Matthew.Bonvicin@bridge.bellsouth.com>
     Re: Perl Source Formatter (Clay Irving)
     Re: Problem with the editor (I think) (Tad McClellan)
     Re: Regex for three equal characters <eike.grote@theo.phy.uni-bayreuth.de>
     Re: Regex for three equal characters <jenkinsrd@cf.ac.uk>
     Re: Regex for three equal characters (Casper K. Clausen)
     Removing Full file path from report (James Gryga)
     Re: Returning information from an nslookup ?? <robert_rich@stercomm.com>
     SEGV coredump problem when use format, formline <febbraro@math.jussieu.fr>
     Re: Socket Problems (Andrew M. Langmead)
     Re: split with capturing parantheses in patte <rootbeer@teleport.com>
     stdout and stdin of ` ` coming to screen <mehta@mama.indstate.edu>
     Re: text stripping (Tad McClellan)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 21 Nov 1997 06:39:50 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: -w flag
Message-Id: <mev356.5j.ln@localhost>

Keith Willis (keith_willis.junk@non-hp-unitedkingdom-om1.om.hp.com) wrote:

: Just a thought...

: I see _so_many_ posts responding to people who have done something
: naive or dumb telling them that if they had only used the -w flag
: usually in conjunction with "use strict", they would have seen the
: reason for the problem immediately.

: I suggest that there is a case for modifying the standard perl
: distribution so that the -w flag is ON by default, but may be switched
: OFF by the use of the command line argument.

: Any takers?


Uh, the very top level man page that is shipped with every proper
perl distribution (perl.pod) has a BUGS section.

The very first bug listed there is:

   "The -w switch is not mandatory."


So, it has already been thought of (and, apparently, rejected ;-)


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


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

Date: 21 Nov 1997 14:36:29 GMT
From: Zenin <zenin@best.com>
Subject: Re: -w flag
Message-Id: <880123137.753137@thrush.omix.com>

Tad McClellan <tadmc@flash.net> wrote:
: The very first bug listed there is:
:    "The -w switch is not mandatory."
: So, it has already been thought of (and, apparently, rejected ;-)
	>snip<

	Actually, I think this is bug in the documentation.  It should
	really read:

	"The -w switch and 'use strict' are not mandatory"

	:-)

-- 
-Zenin
 zenin@best.com


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

Date: Fri, 21 Nov 1997 09:43:36 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: -w flag
Message-Id: <-2111970943360001@aggie.coaps.fsu.edu>

In article <347577e4.1480138@elf.bri.hp.com>,
keith_willis.junk@non-hp-unitedkingdom-om1.om.hp.com (Keith Willis) wrote:

+ I suggest that there is a case for modifying the standard perl
+ distribution so that the -w flag is ON by default, but may be switched
+ OFF by the use of the command line argument.

Which means I'd have to get a program to change all my scripts and remove
the '-w'... :)

James

-- 
Consulting Minister for Consultants, DNRC
Support the anti-Spam amendment <url:http://www.cauce.org/>
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>


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

Date: 21 Nov 1997 13:22:48 GMT
From: fty@hickory.engr.utk.edu (Jay Flaherty)
Subject: Re: 2 Dimensional Arrays - how?
Message-Id: <6541v8$2lu$1@gaia.ns.utk.edu>

Greg Wake (greg@geographe.com.au) wrote:
: 
: Sorry, just starting to get a grip on Perl.
: 
: How can you implement 2 dimensional arrays??
: 
: Any pointers greatly appreciated.

type man perlref, man perldsc, man perllol and/or go to:
http://www.perl.com/CPAN-local/doc/FMTEYEWTK/pdsc/index.html

www.perl.com is your friend :-)
Jay
--
**********************************************************************  
Jay Flaherty                                               fty@utk.edu
"Once in awhile you get shown the light, in the strangest of places if
you look at it right" - R. Hunter
**********************************************************************



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

Date: Fri, 21 Nov 1997 10:49:30 -0600
From: Robert Crooks <robert.crooks@NoSpamnortel.ca>
Subject: A3 Perl Compiler
Message-Id: <3475BB9A.D5D@dognortel.ca>

I was wondering if anyone could help me with the compilation-to-c of 
a perl script.  I am using M. Beattie's Perl Compiler (a3) and I have 
not been successful, yet.  

1. Can you use MB's compiler with Perl 5.004?
	- I have heard that the compiler works with Perl 5.002+ and
	also that it only works with Perl 5.002 and 5.003.

2. I have been able to run the perl -MO=C command, however, when I use
the perl cc_harness command, it leaves me with an unsatisfied symbol: 

	touchline (code)) 
 
I am using the Curses for perl module in my perl scripts and I recognize
touchline() as a curses function, but I don't use it any where in my
code.  Has anyone had a similar problem compiling a perl script using
the Curses module?

I would really appreciate any assistance,
Thanks
Robert Crooks


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

Date: Fri, 21 Nov 1997 09:12:43 -0500
From: Jim Michael <jim.michael@gecm.com>
Subject: Re: Can Perl dial the phone?
Message-Id: <347596DB.2DCB@gecm.com>

> S (se@primenet.com) wrote:
> : Could someone please point me to more info/howto/module for getting
> : perl to dial a phone line.
> : I need to do this for Win95, NT4.0, and Linux

For you DOS boxes try something like:

#!/usr/bin/perl -w
open (COM, ">COM1") || die("can't open com port $!" );
print COM ("$ARGV[0]");
print "Pick up the phone";

Cheers,

Jim


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

Date: Fri, 21 Nov 1997 09:42:29 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Copy files
Message-Id: <-2111970942290001@aggie.coaps.fsu.edu>

In article <01bcf664$23fdf660$7a02a8c0@pc_miran>, "Miran Sepic"
<miran.sepic4@mss.tel.hr> wrote:

+ I have several problems with File::Copy module. Any other suggestions? 

Such as? I can't see what's hard about:

        use File::Copy;
        copy("file1","file2");

but I suppose it could be tainted...details, please??

James

-- 
Consulting Minister for Consultants, DNRC
Support the anti-Spam amendment <url:http://www.cauce.org/>
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>


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

Date: 21 Nov 1997 13:47:13 GMT
From: mheins@prairienet.org (Mike Heins)
Subject: Re: DBM-speed
Message-Id: <6543d1$ko7$1@vixen.cso.uiuc.edu>

Morten Simonsen (mortensi@idt.ntnu.no) wrote:
: Hi
: 
: I plan to build a database using the regular DBM's of Perl. This
: database may grow quite large and I am therefore interested in the
: speed of such a database.
: 
: If I have a database at 100 MB:
: -how long will it take to find a key?
: -how will it perform with respect to memory?
: -how long will it take to insert a new key?
: 
: For the sake of the argument, let's say the machine is a regular PC,
: 32 MB RAM, 200 MHz Pentium.
: 
: It's possible to answer these questions exact, but if someone has an
: qualified opion, I would like to hear it.
: 

As someone who has worked with GDBM, DB_File, and near-gigabyte data
files on similar hardware, I think I have a fairly qualified opinion.

The key accesses will take microseconds depending on how dispersed
they are.  Both GDBM and DB_File do some pretty good caching, so if
your data is at all localized you would do well to use those. The key
accesses don't degrade badly as the database gets larger.

Key insertion slows somewhat on both as the database gets larger --
I find GDBM is a bit faster in that regard. I can insert about
800 keys a second depending on data size. You can play some games
with pre-allocation and bucket size on DB_File, I hear, though
I have never tried. If you have multiple processes writing the
same file, definitely use GDBM for the internal locking.

-- 
Regards,
Mike Heins

This post reflects the
opinion of my employer.


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

Date: Fri, 21 Nov 1997 09:04:04 -0600
From: Mike Snyder <accu-scan@worldnet.att.net>
To: Octavi Esteve-Volart <oesteve@stonehenge.ac.upc.es>
Subject: Re: Downcase/Upcase
Message-Id: <65484k$3f8@bgtnsc02.worldnet.att.net>

> I know this is very basic, but how can I downcase/upcase
> a string in Perl?
> (could you please e-mail me the answer? I'm not a frequent
> news user)


ANSWER CC'd to Email as well as newsgroup.

I found this in the perlop manpage (I am a newbie too, didn't know what
Perl *WAS* until about a week ago).

the tr/ will the conversion for you. If your string was named $rr -->

$rr="This Is A String To Convert"

$rr =~ tr/a-z/A-Z/; ## convert to UPPER CASE
   ##   $rr became "THIS IS A STRING TO CONVERT"

$rr =~ tr/A-Z/a-z/; ## convert to LOWER CASE
   ##   $rr became "this is a string to convert"

If you need to do mixed case, such as capitolizing the first letter and
downcasing all others, there are probably really easy ways to do that as
well, but having not needed to, I'm not sure how.

Anyway, good luck!

Mike.


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

Date: 21 Nov 1997 14:32:50 GMT
From: "James Richardson" <jamesr@aethos.co.uk.nospam>
Subject: Re: File attachments using sendmail
Message-Id: <01bcf68a$714fb4a0$26c0a4c1@kitkat.aethos.co.uk>

eric bucher <erixred@IDT.NET> wrote in article
<6520ek$q9s@nnrp2.farm.idt.net>...
> Dude, try this little snippet of code:
	[naive code deleted]
> It works for me, hope it treats you well.
> 
> later,
> eric
> 

NO! It just wont work (reliably). Mail that goes across the internet is
__NOT__ guaranteed to be 8bit clean. Across a LAN or corporate WAN then
maybe, but if you are mailing across the internet, then you should use one
of the encoding schemes that are currently in use..

Here is an example mail that will support file attachments that you could
use.....

As for the Base64 encoding, look at CPAN for Base64...


From: Your Name Here <you@yourdomain.com>
X-Sender: you@yourdomain.com
To: <recipient@theirdomain.com>
Subject: Whatever
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED;
BOUNDARY="-559023410-959030623-865429783=:7824"

This message is in MIME format.  The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.

---559023410-959030623-865429783=:7824
Content-Type: TEXT/PLAIN; charset=US-ASCII

Your text message goes here... the next bit is the attatchment..

---559023410-959030623-865429783=:7824
Content-Type: IMAGE/JPEG; name="my.jpg"
Content-Transfer-Encoding: BASE64
Content-Description: 

/9j/4AAQSkZJRgABAQEAZABkAAD/2wBDAA0JCgsKCA0LCgsODg0PEyAVExIS
(and so on)

---559023410-959030623-865429783=:7824--



James Ricardson



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

Date: 21 Nov 1997 14:51:49 GMT
From: "James Richardson" <jamesr@aethos.co.uk.nospam>
Subject: Re: File attachments using sendmail
Message-Id: <01bcf68d$18e34360$26c0a4c1@kitkat.aethos.co.uk>



eric bucher <erixred@IDT.NET> wrote in article
<6520ek$q9s@nnrp2.farm.idt.net>...
> Dude, try this little snippet of code:

Oops! Sorry, I misread your message!...... (Sleepy on Friday afternoon :-)
)

Yeah, the code you wrote is fine for text... but there are other
considerations for binary data (reasons given in the last post....)

Apologies for just jumping in there without reading the post properly....

[humble humble]

James Richardson



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

Date: Fri, 21 Nov 1997 06:49:57 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: giving up on flock
Message-Id: <l10456.5j.ln@localhost>

Zenin (zenin@best.com) wrote:
: [ posted & mailed ]

[snip]

: Steve (syarbrou@ais.net) originally asked:
: : I've pretty much had it with flock.  I open a file to read and
: : append(+>>) and it just doesn't seem to work.  My file keeps getting
: : cleared.  Can flock only work for reading or writing?

: 	I get the feeling you're thinking that append is doing something
: 	different than it really does.

: 	When you open a file for append, the position of "0" is NOT the
: 	actual start of the file, but rather the start of the APPEND. eg,
: 	the position of EOF when you first opened it.  Which, in a warped
: 	way makes some sense since you did ask to append to it.

: 	This meens you CAN NOT READ what is already in the file, only what
: 	you've appended yourself since a seek() to 0 will only bring you
: 	to the original EOF location.  Lame yes, I know.


So then, did Randal make a mistake when he posted this?


 ------------------------------
Message-ID: <8csp2sxn15.fsf@gadget.cscaper.com>
From: Randal Schwartz <merlyn@stonehenge.com>
Newsgroups: comp.lang.perl.misc
Subject: Re: locking files on the web?
Date: 19 Feb 1997 18:51:34 -0700

 ...


Here's the canonical "update" model with flocking:

        open FILE, "+>>in-duh-vidual";
        flock FILE, 2;
        seek FILE, 0, 0;
        @contents = <FILE>;
        ## process @contents to the new contents
        seek FILE, 0, 0;
        truncate FILE, 0;
        print FILE @contents;
        close FILE;

Do *not* release the flock before you close.  Bad bad bad.  This *is*
the way.  Yes, *all* of these steps are necessary.  Any deviation will
break down somewhere.  You have been warned.
 ------------------------------


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


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

Date: 21 Nov 1997 14:40:37 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: giving up on flock
Message-Id: <6546h5$gr3$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    tadmc@flash.net (Tad McClellan) writes:
:So then, did Randal make a mistake when he posted this?
:
:From: Randal Schwartz <merlyn@stonehenge.com>
:Newsgroups: comp.lang.perl.misc
:Subject: Re: locking files on the web?
:Date: 19 Feb 1997 18:51:34 -0700
:
:Here's the canonical "update" model with flocking:
:
:        open FILE, "+>>in-duh-vidual";
:        flock FILE, 2;

Yes, Randal was wrong here.  He didn't understand what O_APPEND
was all about.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
"Espousing the eponymous /cgi-bin/perl.exe?FMH.pl execution model is like 
reading a suicide note -- three days too late."
	    --Tom Christiansen <tchrist@mox.perl.com>


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

Date: Thu, 20 Nov 1997 22:59:54 +0300
From: Paul Kolesnikov <beetle@reksoft.ru>
Subject: Heeelp!
Message-Id: <347496B9.ABA626B2@reksoft.ru>

Hello,

I've just joined this Newsgroup and the problem may have been discussed ..., but

any way I would ask everybody for help. The problem is:

When perl program making connection with a remote host (through a proxy) some
command,
like "LIST" did not get result codes through the command socket (the "sysreat"
function is blocked
until the "remote server has closed connection" message got).

I found the following solution:
using the function "select" with the defined timeout and then kick the server by

"NOOP" command.

Does everybody know others solutions



Thank you any way.



--
Paul Kolesnikov                        Software Engineer,
Email: beetle@reksoft.ru               Reksoft Ltd., Russia.





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

Date: Fri, 21 Nov 1997 10:31:17 -0500
From: davereed@webshowplace.com (Dave Reed)
Subject: How to select from 12 step-two forms?
Message-Id: <davereed-2111971031170001@d230.b68.cmb.ma.ultra.net>

How can I give users of my step-one form a selection from a dozen
different step-two forms carrying forward the data they entered?  (The
forms are large, so each must be a different web page.)

I was already doing this at my old ISP which did not allow custom CGIs but
offered a forms processor accessed via
<FORM METHOD=POST ACTION="http://www.ispdom.com/cgi-bin/form">
<INPUT TYPE=HIDDEN NAME=name_result VALUE="result">

So I could provide the options this way:
<FORM METHOD=POST ACTION="http://www.oldispdom.com/cgi-bin/form">
<SELECT NAME="name_result">
  <OPTION VALUE="result1">first result
  <OPTION VALUE="result2">second result
  <OPTION VALUE="result3">third result
  [ . . . and so on . . .]
</SELECT>

Now at my new ISP I have my own cgi-bin with cgi-lib.pl uploaded,
and forms must address their action like this:
<form method="post" action="http://www.mynewdom.com/cgi-bin/vr?myscript.pl">

So now, how can I offer my step-one form users a selection from:
<form method="post"
action="http://www.mynewdom.com/cgi-bin/vr?result1script.pl">
<form method="post"
action="http://www.mynewdom.com/cgi-bin/vr?result2script.pl">
<form method="post"
action="http://www.mynewdom.com/cgi-bin/vr?result3script.pl">
  [ . . . and so on . . .]
where each resultXscript gives the user a different step-two form carrying
forward the data they entered?
(These forms are too large to write all of them into one script with
if...else options.)


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

Date: Fri, 21 Nov 1997 07:26:05 -0600
From: Chris Schmidt <chris@starkimages.com>
Subject: OUTPUT of images and uploading
Message-Id: <34758BEC.5E812AED@starkimages.com>

This is a multi-part message in MIME format.
--------------C7EBA69739EBCE0C2C220B3A
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hello,
I am trying to set up a cgi to upload files from a web browser.  I need
to use a cgi so that I can make the upload user/passwd protected through
a web interface.

thanks for the help

--------------C7EBA69739EBCE0C2C220B3A
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Chris Schmidt
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Chris Schmidt
n:              Schmidt;Chris
org:            Stark Images
adr:            219 N Milwaukee st;;;Milwaukee;WI;53202;USA
email;internet: chris@starkimages.com
title:          Systems Manager
tel;work:       4142262700
tel;fax:        4142262705
x-mozilla-cpt:  ;0
x-mozilla-html: FALSE
end:            vcard


--------------C7EBA69739EBCE0C2C220B3A--



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

Date: Fri, 21 Nov 1997 07:27:18 -0600
From: Chris Schmidt <chris@starkimages.com>
Subject: OUTPUT of images and uploading
Message-Id: <34758C36.44A73481@starkimages.com>

This is a multi-part message in MIME format.
--------------D7395A4ED008477CEFBB5253
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hello,
I am trying to set up a cgi to upload files from a web browser.  I need
to use a cgi so that I can make the upload user/passwd protected through
a web interface.

thanks for the help

--------------D7395A4ED008477CEFBB5253
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Chris Schmidt
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Chris Schmidt
n:              Schmidt;Chris
org:            Stark Images
adr:            219 N Milwaukee st;;;Milwaukee;WI;53202;USA
email;internet: chris@starkimages.com
title:          Systems Manager
tel;work:       4142262700
tel;fax:        4142262705
x-mozilla-cpt:  ;0
x-mozilla-html: FALSE
end:            vcard


--------------D7395A4ED008477CEFBB5253--



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

Date: Wed, 19 Nov 1997 10:11:50 -0500
From: "Karl J. Benko" <kjb@biplane.com>
Subject: Page turner
Message-Id: <347301AF.5862@biplane.com>

Does Perl have anything for me that I can connect to "previous" and
"next" html buttons and have them present html files according to
ascending and descending file name order?

Gosh! I hope I've asked with sufficient succinctness. I know how
everyone hates questions already answered by FAQs.
-- 


    \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_

    "...when you have excluded the impossible,
    whatever remains, however improbable,
    must be the truth." - S.H.


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

Date: 21 Nov 1997 15:05:59 GMT
From: Zenin <zenin@best.com>
Subject: Re: Page turner
Message-Id: <880124907.724857@thrush.omix.com>

[ posted & mailed ]

Karl J. Benko <kjb@biplane.com> wrote:
: Does Perl have anything for me that I can connect to "previous" and
: "next" html buttons and have them present html files according to
: ascending and descending file name order?

	Why perl?  Do you have SSI (Server Side Includes) available?
	If so, what about this:

	Assuming files of 0.html, 1.html, etc...

	<A HREF="<!--#echo var="HTTP_REFERER"-->"> Previous </A>
	<A HREF="<!--#exec cmd="expr `echo $HTTP_REFERER | sed -e 's/\.html//'` + 2"-->.html"> Next </A>

	Although this does have to fork	2 (maybe 3) processes.

-- 
-Zenin
 zenin@best.com


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

Date: 21 Nov 1997 13:49:35 GMT
From: "ATLOTO7" <atloto7@nbnet.nb.a>
Subject: passing more than 1 variable in a href
Message-Id: <01bcf685$291a3d40$cfc7a4c6@PC0413>

Hi all

Thanks for all of your help on my last post (another s/// question)

Now I have another.....I'm trying to pass 2 variables in an href statement
from a web page.  I've been working with variations of the following:

<a href="http://whatever/script.pl?variable1&variable2">link</a>

I pick up the first variable in my script no problem using the following:

if ($#ARGV >= 0)
  {
  $variablename1 = $ARGV[0];
  }
else
  {
  whatever;
  }

I've tried picking up the 2 variable using variations of this:

if ($#ARGV >= 1)
  {
  $variablename2 = $ARGV[1];
  }
else
  {
  whatever;
  }


I can't seem to pick up that 2 variable.  What am I doing wrong?

Thanks again for any help you can offer

Vaughn




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

Date: Fri, 21 Nov 1997 14:48:50 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: passing more than 1 variable in a href
Message-Id: <adelton.880123730@aisa.fi.muni.cz>

"ATLOTO7" <atloto7@nbnet.nb.a> writes:

[...]

> I've tried picking up the 2 variable using variations of this:
> 
> if ($#ARGV >= 1)
>   {
>   $variablename2 = $ARGV[1];
>   }

[...]

> I can't seem to pick up that 2 variable.  What am I doing wrong?

What is the error message that you are getting? Are you using -w and
use strict?

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: 21 Nov 1997 15:15:02 GMT
From: Zenin <zenin@best.com>
Subject: Re: passing more than 1 variable in a href
Message-Id: <880125450.832154@thrush.omix.com>

[ posted & mailed ]

ATLOTO7 <atloto7@nbnet.nb.a> wrote:
: Now I have another.....I'm trying to pass 2 variables in an href statement
: from a web page.  I've been working with variations of the following:
: <a href="http://whatever/script.pl?variable1&variable2">link</a>
                                             /|\
                                   Here ______|

	This ampersand should be a plus ('+') char. -URL encoding for a
	"space" char.  You're going to get the entire 'variable1&variable2'
	as your first argument otherwise, leaving nothing for $ARGV[1].

: I pick up the first variable in my script no problem using the following:
: if ($#ARGV >= 0)
:   {
:   $variablename1 = $ARGV[0];
:   }

	And check out the perlstyle man page when you get a chance.  You're
	code style is ugly, even for a line-noise language like Perl. :-)

-- 
-Zenin
 zenin@best.com


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

Date: Fri, 21 Nov 1997 09:24:36 -0600
From: Matthew Bonvicin <Matthew.Bonvicin@bridge.bellsouth.com>
Subject: PERL Hourly Rates
Message-Id: <3475A7B3.819F9C2E@bridge.bellsouth.com>

Greetings all,

Could someone please provide for me an approximate hourly rate for
advanced PERL CGI scripting.  I may have the need shortly to outsource
some development but am unsure what to expect.

Thanks!
/Matt



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

Date: 21 Nov 1997 09:18:10 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Perl Source Formatter
Message-Id: <654572$l33@panix.com>

In <34742AFB.CCE1A299@lanl.gov> Bill Dorin <bill@lanl.gov> writes:

>Anyone point me to a perl source formatter similar to lint?  Sorry if this 
>has been a previous topic.

>From the "style guides" section of Perl Reference <http://reference.perl.com>:

  pb -- Freeware 
  http://www.arachnoid.com/lutusp/ftp/cgi/pb.txt
  Perl Beautifier -- This script processes Perl scripts, cleans up and 
  indents, like cb does for C 
  
-- 
Clay Irving <clay@panix.com>                   http://www.panix.com/~clay/


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

Date: Fri, 21 Nov 1997 08:13:23 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Problem with the editor (I think)
Message-Id: <3u4456.dt.ln@localhost>

Kobe Lenjou (kobe@technologist.com) wrote:

: I'm a novice Perl writer and I have a serious problem, when I load my
: perfect Perl Script to the server, 


Use ASCII mode FTP transfers instead of binary mode FTP transfers.

FTP will convert line endings for you.


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


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

Date: Fri, 21 Nov 1997 13:06:39 +0100
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: Regex for three equal characters
Message-Id: <3475794F.167E@theo.phy.uni-bayreuth.de>

Hi,

Markus Bubendorf wrote:
> 
> Helo world,

This is just me, not the whole world ...  ;-)

> I'm looking for a regex which matches three or more consecutive equal
> characters. Any ideas?

Something like this ?

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

   $string = 'xx--xxx-----x';
   while($string =~ /(.)\1{2,}/g) { print "Matched: $&\n" }

Note: '(.)' matches any single character and assigns it to '\1'
      and '$1'. '\1{2,}' looks for at least two occurrences of
      the character in '\1' previously found. So the whole regexp
      matches three or more consecutive characters in a string.


Bye, Eike
-- 
=======================================================================
>>--->>    Eike Grote  <eike.grote@theo.phy.uni-bayreuth.de>    <<---<<
-----------------------------------------------------------------------
 Home Page, Address, PGP,...:  http://www.phy.uni-bayreuth.de/~btpa25/
-----------------------------------------------------------------------
 PGP fingerprint:      1F F4 AB CF 1B 5F 4B 1D 75 A1 F9 C5 7B 3F 37 06
=======================================================================


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

Date: Fri, 21 Nov 1997 13:31:47 -0800
From: Dean Jenkins <jenkinsrd@cf.ac.uk>
Subject: Re: Regex for three equal characters
Message-Id: <3475FDC3.2727@cardiff.ac.uk>

Markus Bubendorf wrote:

> I'm looking for a regex which matches three or more consecutive equal
> characters. Any ideas?

RTFM

"Any item of a regular expression may be followed with digits in curly 
brackets of the form {n,m}, where n gives the minimum number of times to 
match the item and m gives the maximum.  The form {n} is equivalent to 
{n,n} and matches exactly n times.  The form {n,} matches n or more 
times.  (If a curly bracket occurs in any other context, it is treated as 
a regular character.) The * modifier is equivalent to {0,}, the + 
modifier to {1,} and the ? modifier to {0,1}.  There is no limit to the 
size of n or m, but large numbers will chew up more memory." Perlman

So how about /.{3,}/

--
Dean Jenkins - Llandough Hospital, Cardiff, Wales.
 12-lead ECG library
 http://homepages.enterprise.net/djenkins/ecghome.html


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

Date: 21 Nov 1997 14:49:07 +0100
From: ckc@hobbes.ejoper.dmi.min.dk (Casper K. Clausen)
Subject: Re: Regex for three equal characters
Message-Id: <wvp7ma2bbmz.fsf@hobbes.ejoper.dmi.min.dk>

Dean Jenkins <jenkinsrd@cf.ac.uk> writes:

> So how about /.{3,}/

While RTFM'ing seems sound advice, maybe you could benefit from RTFP
(... Post) yourself :) The regex you mentioned will match all the
words I've written thus far, while the original poster wanted to match
only such 'words' as 'ggg' or 'jjjjjj'. /(.)\1{2,}/ would be better,
but for effeciency it can't compete with /(.)\1\1+/.

Regards,
Kvan.
-- 
-------Casper Kvan Clausen------ | 'Ah, Warmark, everything that passes
----------<ckc@dmi.dk>---------- |  unattempted is impossible.'
           Lokal  544            |   
I do not speak for DMI, just me. |        - Lord Mhoram, Son of Variol.      


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

Date: Fri, 21 Nov 1997 12:50:56 GMT
From: jamesgry@netcom.com (James Gryga)
Subject: Removing Full file path from report
Message-Id: <jamesgryEJzyCw.1D1@netcom.com>

Hi, Maybe someone can help me.  I have written a short perl script which 
look through a bunch of files that I specify on the command line and 
prints out the subject line and associated file name.  the code  follows 
below this message.  If this script is in the same directory as the 
files, then it works OK.  But I have many directories and 
subdirectories.  I really doesn't make sense to keep moving this script 
to differenct directories or having a copy of the same script in each 
directory.  For example:

FileIndex *.txt >SampleIndex.txt

1)  This will give the following result:

This is the subject line                textfile


But if I do something like

FileIndex ~/Archives/Art_Oct/*.txt >SampleIndex.txt

2) I get the following

This is the subject line               /home/ja


How can I modify this script to get the result 1.

Thank for any help or pointers you can provide.



#!/usr/bin/perl

foreach $file (@ARGV) {
	open(FILE, $file)  || warn "can't open $file:  $!\n";
	while (<FILE>) {
		if (/^Subject: (.*)/) {
		$subject = $1;
		}
	}
# select(INDEX0296);
$~ = 'SUBJECTS';
write();

}

# Here is the top of the form format, with column headings.

format SUBJECTS_TOP =

Subject:						File_Name
---------------------------------------------------     --------
 .

# Here is the format for each record.

format SUBJECTS =

@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<     @<<<<<<<
$subject,                                               $file
 .





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

Date: Fri, 21 Nov 1997 09:24:54 -0500
From: Robert Rich <robert_rich@stercomm.com>
To: Burt Lewis <burt@ici.net>
Subject: Re: Returning information from an nslookup ??
Message-Id: <347599B6.A1D621@stercomm.com>

I'm using this in a cgi script currently:

input:
$input is either hostname or ip address...
output:
$ip is ip address
$name is hostname

i'm no expert, this was just kind of snipped and reworked from another
piece of code...  doesn't require any packages however.. :)


if ($input =~ /[A-Za-z]/) {
        $ip = sprintf "%d.%d.%d.%d", unpack ('C4', gethostbyname
$input);
        $name = $input;
   } else {
        $ip = $input;
        $input =~ /(\d+).(\d+).(\d+).(\d+)/;
        $iaddr = pack ('C4',$1,$2,$3,$4);
        $name = gethostbyaddr( $iaddr, 2 ); #AF_INET = 2
   }


 
Burt Lewis wrote:
> 
> Hi,
> 
> I'm capturing IP's using "$ENV{'REMOTE_HOST'} from an SSI page.
> 
> I want to then do an nslookup to capture the domain as a variable that I can read back to the
> webpage and write to file.
> 
> I have this but I don't know how to return the answer.
> 
> print "Content-type: text/html\n\n";
> 
> system "nslookup 207.180.0.20";
> 
> Appreciate any help on this.
> 
> Burt Lewis


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

Date: 21 Nov 1997 16:37:57 +0100
From: Philippe Febbraro <febbraro@math.jussieu.fr>
Subject: SEGV coredump problem when use format, formline
Message-Id: <lbtzentpm.fsf@math.jussieu.fr>


Hi,

I use perl 5.003 on SunOS system.

I want to generate dynamicly some formats in a script.

Following man perlform, I tryed to use a function like swrite, using 
formline.

For this I wrote this code:

1>   sub swrite {
2>     croak "usage: swrite (FORMAT ARGS)" unless @_;
3>     local $format = shift;
4>     $^A = "";
5>     formline($format,@_);
6>     return $^A;
7>   }

$format is "local" and not (as recommanded) a "my" variable, otherwise
this function don't operate as I want:

If I use more than one $format, only the first is avialable:

I have two formats: $format1, and $format2.

When I call at the first time

$header = swrite($format1, @infos);

The  string $header is correctly formated, following $format1. (logical)

At the second time, I call with $format2 as string format:

$ligne = swrite($format2, @infos);

 ...and the string is formated following $format1 !!!  :-\

But when I use local, what I get is what I'm expecting. 

It's strange but functional ! :-\


BUT THE PROBLEM IS NOT HERE! :
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
When I try to use this in a short script, it's already functional.

Unfortunnately, When I use this function in a real script, which use
consequent memory, it generates a SEGV coredump ...where it tryed to
return $^A ! 
Usually, the string generated in this script don't use more than 70
caracters.
:-< 

The worst: When I'm debugging:
 . At a  time, when I'm on line 6, if I want to print $^A (debug: p $^A),
  it make a SEGV coredump.

 . At a time, it pass, and show the good string.

Somebody can help me ?


PS: I generate my $format1 and $format2 using this code:

($format1,$format2) = genPrintFormat($nbPrinters);

sub genPrintFormat {
  local ($nbPrinters) = $_[0];
  my ($format,$format_top);

  # for "user" field
  $format	=  '@' . '<' x 17;
  $format_top	=  '@' . '<' x 17;

  # for Printers fields (+1 because I whant also a 'total' field
  $nbPrinters++;
  while ($nbPrinters--) {
    $format	.= "\t@" . ">" x  8;
    $format_top	.= "\t@" . '|' x  8;
  }
  $format	.= "\n";
  $format_top	.= "\n\n";
  
  return ($format,$format_top);
}

-- 
 		---===== Philippe FEBBRARO =====---       
 		   febbraro@medoc-ias.u-psud.fr
 		   febbraro@math.jussieu.fr
(ALT !  new domain name:    ^^^^            )
 
 	Un sage a dit un jour:
 	La perfection n'est pas dans l'homme mais parfois 
 	dans ses intentions
 
 	" Le Paradis, c'est l'Enfer! " (Ambiguite ?)


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

Date: Fri, 21 Nov 1997 15:47:14 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Socket Problems
Message-Id: <EK06Iq.92p@world.std.com>

mchorgh@ike.com writes:

>	socket(S,AF_INET,SOCK_STREAM,$proto);
>	select(S); $|=1; select(STDOUT);
>	unless(connect(S, $that_addr))
>		{Error("No Connection");}
>   	$reply = <S>;
>	print "$reply";
>	while (S){print S "$UID\n";}
              ^^^^
>	$reply2 = <S>;
>	print "$reply";


You probably don't want to be doing this. You aren't performing any
sort filehandle operation here, and I think that perl is just treating
the S, as the string 'S'. (In this context it is a bareword, which
given no other meaning, and without the 'use strict' pragma to
dissallow it, is converted to a string.)

I would have guessed that you were trying to read from S, execept that
the very next line after the loop (once there is no more data from S)
you then read another line.

Are you trying to find out the readability/writability of 'S'? If so,
you might want to look at the select() function.

-- 
Andrew Langmead


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

Date: Fri, 21 Nov 1997 07:42:21 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Benjamin Trott <btrott@scuacc.scu.edu>
Subject: Re: split with capturing parantheses in patte
Message-Id: <Pine.GSO.3.96.971121074020.8884L-100000@usertest.teleport.com>

On Wed, 19 Nov 1997, Benjamin Trott wrote about the behavior of a
more-or-less obscure corner of Perl:

> It seems to be this way from the few tests I gave it, but I'd like
> to actually be sure. 

If the docs don't specify the behavior, try submitting a documentation
patch and ask whether you got it right. If the patch is accepted into the
next release of Perl, you did. :-)  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/
              Ask me about Perl trainings!



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

Date: Fri, 21 Nov 1997 03:01:55 GMT
From: Miten S Mehta <mehta@mama.indstate.edu>
Subject: stdout and stdin of ` ` coming to screen
Message-Id: <Pine.LNX.3.96.971120215149.32364B-100000@mama.indstate.edu>



11/20/97

Hello,

I have to do some sccs commands which need to loop through a list of files
either as command line wildcards or by some other means.  I need to let
the user type in the responses for the sccs commands.  I do not know how
to let the looped shell command or script to interact so am currently
rescued by csh scripts.  could you guide how do I go about using perl for
this problem?  I would also love to know if there is some module for this.

Thank you.

Have a good day !!!

Best Regards,

Miten Mehta.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
Res:                                            |
Miten S Mehta                                   |
311 S Lasalle St, 39E,		                |
Durham, NC 27705                                |
Tel: 919 416 3889                               |             
e-mail: mehta@mama.indstate.edu                 |
resume url:                                     |
ftp://mama.indstate.edu/users/mehta/resume.html | 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~             





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

Date: Fri, 21 Nov 1997 08:02:19 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: text stripping
Message-Id: <b94456.7s.ln@localhost>

BEN GILBERT (beg1@axe.humboldt.edu) wrote:

: I am trying to strip one sentence out of a file. Stated differently how do
: I get everything in a file that is between <b> and </b>? I understand and
: found a lot of material on how to do substitutions, but I want to get a
                                                          ^^^^^^
: specific line (not necessarily by line number) and place it into another
  ^^^^^^^^^^^^^

So then the start and end tags are required to be on the same line?

I wouldn't count on that...


-----------
#!/usr/bin/perl -w

undef $/;       # set slurp mode
$_ = <>;        # slurp

print "$1\n" while m#(<b>.*?</b>)#gsi;

#  this can also be done as a one-liner:
#
#  perl -0777 -n -e 'print "$1\n" while m#(<b>.*?</b>)#gsi;' <filenames...>
-----------


: file. Thanks so much.


You're welcome.


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


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

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

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