[10416] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4009 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 19 14:02:44 1998

Date: Mon, 19 Oct 98 11:00:28 -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           Mon, 19 Oct 1998     Volume: 8 Number: 4009

Today's topics:
        Apache-User <christian.koch@fuzzy-online.de>
    Re: Are there no PERL experts out there?? Is there no o (courtesy)
        Can someone help me with the following for a friend I k richardhutnik@hotmail.com
    Re: Can someone help me with the following for a friend (Larry Rosler)
        CGI Sscript  Exporting Excel File <user@cisco.com>
        Creating database using Access97 and perl (EXCHANGE:CAR:7Y14)
    Re: Creating database using Access97 and perl <perlguy@technologist.com>
        Define: *Process* <jimyt@yahoo.com>
    Re: File I/O <newsonly@usa.net>
    Re: File I/O <newsonly@usa.net>
    Re: Getting Perl to forget - reinitialisation of variab (courtesy)
        Glob Prob <minich@globalnet.co.uk>
        Imagemaps on NT <corder@globalnets.com>
    Re: Info on crypt() (Bart Lateur)
    Re: lack of flock() for Win95/98? fix? <Allan@due.net>
    Re: Memory problems <amorgan@vsol.com>
        Nested RegEx Matches <george.cutrell@instep-solutions.com>
    Re: Nested RegEx Matches <erhmiru@erh.ericsson.se>
        ODBC Compliance <yoann.lecorvic@infrasoft-civil.com>
    Re: Passing by Reference for Performance Reasons? (Joachim Zobel)
    Re: Perl Cookbook - is this the best perl book? paulwade@my-dejanews.com
        Perl Sockets, receiving data. djbelly@my-dejanews.com
        Problem with Perl <rachael@holly.ColoState.EDU>
        QUERY_STRING + code ??? (_cim_)
        QUERY_STRING ???? (_cim_)
    Re: QUERY_STRING ???? <Tony.Curtis+usenet@vcpc.univie.ac.at>
        Removing spaces between fields in file records <whitepr@scp1.bellcore.com>
    Re: Removing spaces between fields in file records (David Alan Black)
    Re: Replacing multiply ":" with a string. <erhmiru@erh.ericsson.se>
        Resubmitted ... Removing spaces between fields in file  <whitepr@scp1.bellcore.com>
    Re: Shell commands eugene@vertical.net
    Re: Shell commands <tchrist@mox.perl.com>
    Re: Shell commands (Mark-Jason Dominus)
    Re: Slow Sort? (Steve Monson)
        Tables with CGI module (John Horne)
        Tilde delimited parsing <marx@idiom.com>
    Re: Tilde delimited parsing <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: Tilde delimited parsing <jim.michael@gecm.com>
    Re: Trouble scheduling Perl scripts with WinNT AT comma <gbuehler@NOSPAMmed.unc.edu>
    Re: What are these? (Dave Cross)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Mon, 19 Oct 1998 18:28:49 +0200
From: "Christian Koch" <christian.koch@fuzzy-online.de>
Subject: Apache-User
Message-Id: <70fp88$7go$1@black.news.nacamar.net>

I want to creat an User for my Apache Web-Server with a Perl-Script. There
is a tool htpasswd to do it.
My problem is, that I can't write the user and password in the command line.
The tools nedds the password in a special input line. What con I do, that
the Perl-Script can insert the password in this input line.

Christian




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

Date: 19 Oct 1998 16:53:11 GMT
From: Bob Shair (courtesy) <rmshair@delphi.itg.uiuc.edu>
Subject: Re: Are there no PERL experts out there?? Is there no one who can solve this??
Message-Id: <70fqpn$dpv$1@vixen.cso.uiuc.edu>

Rafely@xxiname.com wrote:
> Hello,

> I'm making a form so users can send me information.
> The also have to send me their name. How do I check
> and see if the name only consists of letters and white
> spaces?? 

Take it up with my old friend Charley 4trees.


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

Date: Mon, 19 Oct 1998 15:00:00 GMT
From: richardhutnik@hotmail.com
Subject: Can someone help me with the following for a friend I know?
Message-Id: <70fk5g$5pp$1@nnrp1.dejanews.com>

I had a friend send me the following request via email, for a PERL class they
are taking.  I was wondering if you could help me out here.  Thanks.

- Richard Hutnik.

HERE'S THE LETTER I GOT....

Rich:
I was working on it. I was trying to get more stuff done. Wasn't able
to solve it.

Here's the problem:

Write a perl program that reads in lines of data from the data file
hw3.dat which:

a) Calculate the number of words (lines) in the input file.
--did this. This code works.

b) Finds the words that contain two vowels in succession.
--wrote this. Not sure if it works. I can't get my data to print. How
do you print string scalars? Tried many things, none work! I think my
pattern in wrong.

c) It must determine the words that end with the same vowel they begin with.
--wrote this code. Not sure if the pattern is right.

d) Find the words with exactly two vowels anywhere in the word.
--Wrote this code. Don't know if it words.

Next, I have to put it into cgi script.


HERE'S THE CODE:

#!/usr/bin/perl

print "Content-type:   text/html\n\n";

open (InFile, "Hw3.dat") || die;

$count = 0;

while ($line = <InFile>)
{
    chop ($line);

    $count+=1;     if ($line = ~/(a|e|i|o|u) {2}/)        {

           print "This word contains two vowels in succession \n" %s, $line;

        }

if ($line = ~/ [aeiou] && [aeiou]/)        {

          print "The word has exactly two vowels anywhere in the word  \n";

        }

if ($line = ~/\b a|e|i|o|u \b/)
{

          print "The word begins and ends with the same vowel \n";

}

}

print "the number of lines in the input file is $count \n";close (InFile);

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 19 Oct 1998 08:37:50 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Can someone help me with the following for a friend I know?
Message-Id: <MPG.1094fcac3253b8cb9898c6@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <70fk5g$5pp$1@nnrp1.dejanews.com> on Mon, 19 Oct 1998 
15:00:00 GMT, richardhutnik@hotmail.com <richardhutnik@hotmail.com> 
says...
> I had a friend send me the following request via email, for a PERL class they
> are taking.  I was wondering if you could help me out here.  Thanks.
> 
> - Richard Hutnik.

 ... 'a friend' ... 'they are'???  Do you mean 'she is'?

The response has already been posted, reluctantly.

Only one more observation:  If the program is to produce readable CGI 
output to a browser, either the first line printed must be changed to 
indicate plain text (not HTML), or either of two other possible changes 
must be made to what is printed, to cause newlines to appear where 
expected.

I leave this as an execise for the would-be student, who seems more 
capable of rallying others to her support than of solving the real 
problems herself.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Mon, 19 Oct 1998 10:29:19 -0700
From: user <user@cisco.com>
Subject: CGI Sscript  Exporting Excel File
Message-Id: <362B76EF.72B62D21@cisco.com>

Hi,

I got two questions reg this.

1. Is there a way to export this file other than a 
 Tab delimieted file ? 

2. If this fileis about 10-13 K it akes very long to down load.
    ( text/thml and tab delimited file)

   Id there a way to mke  it faster or
   solely depends on PC ?


Thanks

Anu


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

Date: Mon, 19 Oct 1998 10:54:27 -0400
From: "Desfonds, Eric (EXCHANGE:CAR:7Y14)" <onpcoop@americasm01.nt.com>
Subject: Creating database using Access97 and perl
Message-Id: <362B52A2.D005C960@americasm01.nt.com>

Hi,
we are building a new database using an existing database in Access 97... (Not
my choice).

I am wondering if any of you guys (and gals!), ever had to build something
similar, here is the main objectives :
* We want to access the DB and be able to modify records, search, etc...
basically we would like to use SQL statements...
* We would like to be able to have our HTML forms completely language
independant, basically we would pick up the actual text in the pages, from a
translation table, and create the pages with a perl script probably.

Basically, I would like to know if anybody know about a basic realistic way off
getting Perl/SQL and Access to work together.  Please note that I would like to
get away from Access, and use a standard format for the database, any
suggestions.

Please reply by e-mail : ricdef@cyberus.ca, thank you!

Eric Desfonds



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

Date: Mon, 19 Oct 1998 15:59:10 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: Creating database using Access97 and perl
Message-Id: <362B61CE.5C4B1B85@technologist.com>

"Desfonds, Eric (EXCHANGE:CAR:7Y14)" wrote:
> 
> Hi,
> we are building a new database using an existing database in Access 97... (Not
> my choice).
> 
> I am wondering if any of you guys (and gals!), ever had to build something
> similar, here is the main objectives :
> * We want to access the DB and be able to modify records, search, etc...
> basically we would like to use SQL statements...
> * We would like to be able to have our HTML forms completely language
> independant, basically we would pick up the actual text in the pages, from a
> translation table, and create the pages with a perl script probably.
> 
> Basically, I would like to know if anybody know about a basic realistic way off
> getting Perl/SQL and Access to work together.  Please note that I would like to
> get away from Access, and use a standard format for the database, any
> suggestions.
> 
> Eric Desfonds


Basically and realistically you need to use the DBI module and the ODBC
driver for it.

Then, if you change databases, the only thing you *should* need to
change is the driver, all of the other code should work.


> Please reply by e-mail : ricdef@cyberus.ca, thank you!

Post here, read here.  This benefits everyone...

HTH,
Brent
-- 
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$            Brent Michalski             $
$         -- Perl Evangelist --          $
$    E-Mail: perlguy@technologist.com    $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$


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

Date: Sun, 18 Oct 1998 23:10:45 +0100
From: "Main News" <jimyt@yahoo.com>
Subject: Define: *Process*
Message-Id: <tuKW1.13837$n5.11832@news.giganews.com>

Hi,
as a relative newbie to Perl I've been trundlin' through 'Learning Perl' and
'Programming Perl' with up to now, great success. However I'm having a bit
of trouble understanding forking and exec. The explanations in both books
and other material refer to "processes", both child and parent, these are
the terms that are puzzling me. Could someone give me an explanation of
exactly what a process is (in layman's terms) with regards to programming.
Or alternatively point me to some relevant sites.


Much appreciated
Jim.

PS. Does anybody know of any websites dealing with databases *in general*,
eg. uses, usefulness, when to use them, advantages over flat-files etc.




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

Date: Mon, 19 Oct 1998 11:40:38 -0400
From: "Bob L." <newsonly@usa.net>
Subject: Re: File I/O
Message-Id: <F0JW1.326$H9.72625@proxye1.nycap.rr.com>

Hi Jonathan:

Can you give me the URL of site where you found perlfaq5?

Thanks.

Bob


Jonathan Feinberg <jdf@pobox.com> wrote in message
m3r9w4fze5.fsf@joshua.panix.com...
>"Bob L." <newsonly@usa.net> writes:
>
>> 1.  open a text file
>> 2.  lock it so no other script can open it.
>> 3.  read the contents
>> 4.  parse the contents, locating a counter, add 1 to the counter
>> 5.  write the contents to the file
>> 6.  close the file - and it will be unlocked when it is closed.
>
>You forgot
>
>  0.  RTFM
>
>perlfaq5: "I still don't get locking.  I just want to increment the
>number in the file.  How can I do this?"
>
>--
>Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
>http://pobox.com/~jdf




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

Date: Mon, 19 Oct 1998 11:41:53 -0400
From: "Bob L." <newsonly@usa.net>
Subject: Re: File I/O
Message-Id: <O1JW1.327$H9.72625@proxye1.nycap.rr.com>

Hi Jonathan:

Can you give me the URL of site where you found perlfaq5?

Thanks.

Bob


Jonathan Feinberg <jdf@pobox.com> wrote in message
m3r9w4fze5.fsf@joshua.panix.com...
>"Bob L." <newsonly@usa.net> writes:
>
>> 1.  open a text file
>> 2.  lock it so no other script can open it.
>> 3.  read the contents
>> 4.  parse the contents, locating a counter, add 1 to the counter
>> 5.  write the contents to the file
>> 6.  close the file - and it will be unlocked when it is closed.
>
>You forgot
>
>  0.  RTFM
>
>perlfaq5: "I still don't get locking.  I just want to increment the
>number in the file.  How can I do this?"
>
>--
>Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
>http://pobox.com/~jdf






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

Date: 19 Oct 1998 17:26:38 GMT
From: Bob Shair (courtesy) <rmshair@delphi.itg.uiuc.edu>
Subject: Re: Getting Perl to forget - reinitialisation of variables
Message-Id: <70fsoe$g44$1@vixen.cso.uiuc.edu>

jerh@my-dejanews.com wrote:

> I'm processing through many files and generating hashes of hashes on each
> pass and then using these HoHs to generated new data files. My problem is
> that I want the HoH to be blank at the start of each iteration s.t. each new
> file doesn't contain an amalgamation of the info form the previous iteration.
> (something akin to free'ing the mem. associated with the HoH b4 the start of
> the next iteration)

Someday I'll figure out a really reliable way to clear all such carryovers.
In the mean time, I'm running:

#!/usr/bin/ksh
for i in `ls`;do
perl fixup $i
done

Ugly, but works very well.
-- 

Bob Shair                          rmshair@delphi.itg.uiuc.edu
Open Systems Specialist    	   Champaign, Illinois		   
/*  Opinions expressed are mine... go get your own!       */


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

Date: Mon, 19 Oct 1998 18:45:33 +0100
From: "Martin" <minich@globalnet.co.uk>
Subject: Glob Prob
Message-Id: <70ftr1$i89$1@newnews.global.net.uk>

Hi!

I have the following:

@threads = <*.*>;

which won't include in the array files with no extension. Is there anyway to
modify the glob to let it do that?

Martin




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

Date: Mon, 19 Oct 1998 10:52:06 -0500
From: Cliff Corder <corder@globalnets.com>
Subject: Imagemaps on NT
Message-Id: <362B6026.78700CB8@globalnets.com>

Does anyone know where I can find a script for server-side imagemaps on
NT?

Thanks
Cliff Corder



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

Date: Mon, 19 Oct 1998 17:14:18 GMT
From: bart.mediamind@ping.be (Bart Lateur)
Subject: Re: Info on crypt()
Message-Id: <362b71fc.33728398@news.ping.be>

Peter Holzer wrote:

>bart.mediamind@ping.be (Bart Lateur) writes:
>
>>In particular I want to create my own password geberation/encryption
>>code. One requirement I put on it, is that generated passwords only
>>consist of upper case letter, and digits: [A-Z0-9]. 
>
>Sure you want upper case, not lower case? Most people would hate to hit
>caps lock to enter their password (German users would hate it even
>more, since German keyboards have a shift lock key instead of caps
>lock).

In fact, I make it case insensitive. Case sensitive "passwords" don't
make much sense, since people usually can't see what they type in. But
anyway, no accented characters; only plain letters.

>I suspect that perl always uses the crypt function from the C library,
>so that the crypt(3) man page tells you about the behaviour of crypt
>for your system. 

That means that the results depend on the platform??? Nice portability. 

In a way, it makes sense, if you want to use it to manipulate the
password files. If you have another use, like me, this bites.

>A simple check: The standard unix crypt always returns a 13 character
>string of the characters [+/0-9A-Za-z], and the first two characters
>are equal to the salt. If your crypt behaves differently, your system
>uses a different crypt function.

My system says:

>The crypt() function is unimplemented due to excessive paranoia. at test.pl line 3.

Even more portability fun. ;-)

	Bart.


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

Date: Mon, 19 Oct 1998 13:11:14 -0400
From: "AmD" <Allan@due.net>
Subject: Re: lack of flock() for Win95/98? fix?
Message-Id: <70frjp$j7v$1@camel29.mindspring.com>


Jan VanderStoel wrote in message <362982ed.0@blushng.jps.net>...
>I attempted to run a Perl script using the flock() function on a Win 98
>platform using Perl 5.005.  The script failed giving an error message
saying
>that the flock() function is not implemented on this platform.  The docs do
>not indicate that flock() is not implemented.  This script does work on Win
>NT 4.  Is there a fix for the Win 95/98 platform?


Linux, FreeBSD? <g>

AmD




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

Date: Mon, 19 Oct 1998 10:49:58 -0700
From: Adam Morgan <amorgan@vsol.com>
Subject: Re: Memory problems
Message-Id: <362B7BC5.4751E7B@vsol.com>

I have sent the cource code to your email address. Thanks for your interest.

Jonathan Stowe wrote:

> On Sat, 17 Oct 1998 12:12:18 -0700 Adam Morgan <amorgan@vsol.com> wrote:
> > Does anyone know how to monitor memory use in Perl? I keep running out.
> >
>
> Whaddya mean ?
>
> You can use top or sar or your taskmgr or whatever.
>
> Alternatively you could show us the code that you find problems with
> 'cause there's almost certainly a more memory efficient way to achieve
> what you want to do.
>
> /J\
> --
> Jonathan Stowe <jns@btinternet.com>
> Some of your questions answered:
> <URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Mon, 19 Oct 1998 10:50:57 -0400
From: George Cutrell <george.cutrell@instep-solutions.com>
Subject: Nested RegEx Matches
Message-Id: <362B51D1.2AFE2524@instep-solutions.com>

I have some template HTML that has some special tag blocks that I'm
trying to iterate over.  For example:

	<BLOCK name="list1">
		... html ...
		<BLOCK name="list2">
			... html ...
		</BLOCK>
	</BLOCK>
	... html ...
	<BLOCK name="list3">
		....
	</BLOCK>

This does not seem to be working

	$_ = $fileAsString;
	while( /(<BLOCK[^BLOCK>]+BLOCK>)/is ){
		my $block = $1;
		... do some work ...
	}

How do you treat "BLOCK>" inside the "[^BLOCK>]" as a string and not
just a set of characters?  Or is there a better way to iterate over
something like this?

Thanks,
George Cutrell
InStep Solutions
george.cutrell@instep-solutions.com


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

Date: 19 Oct 1998 17:11:57 +0200
From: Michal Rutka <erhmiru@erh.ericsson.se>
To: george.cutrell@instep-solutions.com
Subject: Re: Nested RegEx Matches
Message-Id: <lar9w4oabm.fsf@erh.ericsson.se>

George Cutrell <george.cutrell@instep-solutions.com> writes:
[...]
> I have some template HTML that has some special tag blocks that I'm
> trying to iterate over.  For example:
<cut>
> How do you treat "BLOCK>" inside the "[^BLOCK>]" as a string and not
> just a set of characters?  Or is there a better way to iterate over
> something like this?

Perhaps you would like to use HTML::TreeBuilder?

Michal


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

Date: Mon, 19 Oct 1998 17:08:21 +0100
From: Yoann Le Corvic <yoann.lecorvic@infrasoft-civil.com>
Subject: ODBC Compliance
Message-Id: <362B63F5.478C51D8@infrasoft-civil.com>

Is there a way to connect to an Access Database with Perl. I
investigated WIN32::ODBC, but it seems that it's only for Windows
Envirmonment. I use a Novell Web Server, and I would like to create CGIs
that access an Access Database...

Is that possible ???



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

Date: Mon, 19 Oct 1998 16:36:07 GMT
From: jzobel@my-dejanews.com (Joachim Zobel)
Subject: Re: Passing by Reference for Performance Reasons?
Message-Id: <362ad9b8.1936484@dilbert.crrrwg.de>

Jonathan Feinberg <jdf@pobox.com> wrote:

>jzobel@my-dejanews.com (Joachim Zobel) writes:
>
>> Does it make sense in perl to pass parameters by reference for
>> performance reasons or does perl internally implement copy on write
>> and what i'm doing is nonsense?
>
>Note that perlsub says "scalars are already passed by reference".
>Check out perlsub.

Yes, but I copy them to my variables to have sensible names. 

Joachim

"I read the news today oh boy"             - The Beatles - A Day In The Life

Althoug this message has a valid From header, replies 
to user@kud.com where user = jzobel are preferred.


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

Date: Mon, 19 Oct 1998 16:14:32 GMT
From: paulwade@my-dejanews.com
Subject: Re: Perl Cookbook - is this the best perl book?
Message-Id: <70foh8$c13$1@nnrp1.dejanews.com>

In article <6vv8h6$799$1@nnrp1.dejanews.com>,
  lqyrms@nottingham.ac.uk wrote:
> Could anybody who has read the Perl Cookbook please tell me if this is the
> best perl book to get. There are a couple of reviews of this book at amazon
>  http://www.amazon.com/exec/obidos/ASIN/1565922433/bibs/  , but I would
> appreciate the views of the experts in this newsgroup too.
>
> Many thanks,
>
> --
> Mark.


Depends what you mean by 'best' and for what purpose. However, it is an
excellent book.

Paul.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 19 Oct 1998 17:38:10 GMT
From: djbelly@my-dejanews.com
Subject: Perl Sockets, receiving data.
Message-Id: <70fte2$jpj$1@nnrp1.dejanews.com>

Communicating with a server written by yourself, of course, is very easy. 
You make your own delimiters and ways to close a connection, etc... it's all
quite simple.

Now I am trying to talk to a server that was not written in Perl.  Actually,
several.  None, however, use the same delimeters for lines or end of
transmissions.	That's not really a big deal, I roll with the punches just
like for new kinds of files and stuff- I have written a number of annoying
scripts that steal data from web pages (dictionary definitions, stock prices,
etc) and mail from POP servers.  BUT, there must be ways to test the
following:

Is the connection opened or closed?
  (Something to do with my SOCKET "file" variable?)
Is there data waiting to be received?
  (recv() and <SOCKET> statements lock and return no value if there is none.)

This would be especially useful knowledge for working with FTP and other
complex servers with lots of options.  One wonderful person on the #perl IRC
group on Effnet told me I need to research non-blocking sockets.  Perhaps I
should, but I can't help but think there should be a test for my two above
concerns.

I have attempted to read using scripts run on Solaris 2.6, Linux 2.0.9, and
Windows NT.  My versions of Perl are all up to date.

Thanks,
Daniel

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 19 Oct 1998 17:27:27 GMT
From: Rachael Thompson <rachael@holly.ColoState.EDU>
Subject: Problem with Perl
Message-Id: <70fspv$a5h2@yuma.ACNS.ColoState.EDU>

I am having trouble getting the install of Perl to work on my HPUX system.

I have a HP9000/380 with HPUX 9.10 that errors out everytime it gets to the 
compiling of toke.c.  It finds an error in Perl_yylex and errors out with
an out of memory.  I have 48 megs of ram and I have even tried installing
in a console login.  No X, nothing extraneous running.  I was wondering if
anyone has seen this happen before.  It happens exactly the same on 
5.004_04 and 5.005_02 at the exact same place.  If you need the exact error
I can get it, but I am at work right now.

TIA

Rachael


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

Date: Mon, 19 Oct 1998 18:06:01 GMT
From: cim@online.ee (_cim_)
Subject: QUERY_STRING + code ???
Message-Id: <362b7e61.46292592@news.online.ee>

I wrote a script that checks QUERY_STRING and then acts according to
it. The script when run alone works 100%, but i want to use it inside
html like this:

<A HREF="http://www.a.com/cgi-bin/script?var1=10">
<IMG SRC="http://www.a.com/cgi-bin/script?var2=20"></A>

but it doesn't work. What am i doing wrong?

script:

$string = "$ENV{'QUERY_STRING'}";

print "Content-type: text/html\n\n";

if  ($string eq "var1=10") {&link;} 
elsif ($string eq "var2=20") {&gfx;} 
else {&error;} 

sub link { 
 print "<A HREF=\"http://www.a.com/b/c.html\">\n";
} 
  
sub gfx { 
 print "<IMG SRC=\"http://www.a.com/b/c.gif\"></A>\n";
} 
  
sub error { 
print "<h1>Error!</h1>";
} 

exit;


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

Date: Mon, 19 Oct 1998 17:30:12 GMT
From: cim@online.ee (_cim_)
Subject: QUERY_STRING ????
Message-Id: <362b7637.44202388@news.online.ee>

I wrote a script that checks QUERY_STRING and then acts according to
it. The script when run alone works 100%, but i want to use it inside
html like this:

<A HREF="http://www.a.com/cgi-bin/script?var1">
<IMG SRC="http://www.a.com/cgi-bin/script?var2"></A>

but it doesn't work. What am i doing wrong?


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

Date: 19 Oct 1998 18:36:25 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: QUERY_STRING ????
Message-Id: <83n26s4igm.fsf@vcpc.univie.ac.at>

Re: QUERY_STRING ????, cim <cim@online.ee> said:

cim> I wrote a script that checks QUERY_STRING and then acts
cim> according to it. The script when run alone works 100%,
cim> but i want to use it inside html like this:

cim> <A HREF="http://www.a.com/cgi-bin/script?var1"> <IMG
cim> SRC="http://www.a.com/cgi-bin/script?var2"></A>

cim> but it doesn't work. What am i doing wrong?

You're not showing us the code!

-- 
Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien,  | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!  | private email:
    Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>


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

Date: Mon, 19 Oct 1998 12:31:27 -0400
From: Paul White <whitepr@scp1.bellcore.com>
Subject: Removing spaces between fields in file records
Message-Id: <362B695F.6210@scp1.bellcore.com>

I am trying to write a record to a file
that is a series of data fields separated
by commas.

Unfortunately, spaces " " are inserted into 
every record that I write.

Here is the code:

format DATAREC
@<<<<< @<<<<< @<<<<< 
$rec_a, $rec_b, $rec_c
 .
open (DATAREC,">output.dat");
for (i=0;i=5:i++){
$rec_a = "a" . ",";
$rec_b = "b" . ",";
$rec_c = $rec_a . $rec_b;
write DATAREC;
}
close (DATAREC); 


Here is the output, which I don't want:
 a, b, ab
 a, b, ab
 a, b, ab
 a, b, ab
 a, b, ab
 a, b, ab

Here is what I want as an output:   
a,b,ab
a,b,ab
a,b,ab
a,b,ab
a,b,ab

All comments, suggestions ... welcomed.

Paul


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

Date: 19 Oct 1998 12:54:54 -0400
From: dblack@pilot.njin.net (David Alan Black)
Subject: Re: Removing spaces between fields in file records
Message-Id: <70fqsu$l6v$1@pilot.njin.net>

Hello -

Paul White <whitepr@scp1.bellcore.com> writes:

>I am trying to write a record to a file
>that is a series of data fields separated
>by commas.

>Unfortunately, spaces " " are inserted into 
>every record that I write.

>Here is the code:

>format DATAREC

I never use formats, but surely that should be:

format DATAREC =

>@<<<<< @<<<<< @<<<<< 
>$rec_a, $rec_b, $rec_c
>.
>open (DATAREC,">output.dat");
>for (i=0;i=5:i++){

Didn't you wonder why your program died with copious error messages
when it got to that line?  No - actually it would have died already.

>$rec_a = "a" . ",";
>$rec_b = "b" . ",";

Why not: $rec_a = "a,";

etc.

>Here is the output, which I don't want:

No.  Here is the output:

orpheus:~/perl$ perl datarec
syntax error at datarec line 2, near "@<"
Execution of datarec aborted due to compilation errors.

>All comments, suggestions ... welcomed.

Post real code.  Yes, we've al(most al)l done the thing where you
tweak just before posting and break something....  But what you've
done here is extremely careless. 


David Black
dblack@pilot.njin.net


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

Date: 19 Oct 1998 17:14:26 +0200
From: Michal Rutka <erhmiru@erh.ericsson.se>
To: ava@softclub.net
Subject: Re: Replacing multiply ":" with a string.
Message-Id: <laogr8oa7h.fsf@erh.ericsson.se>

"Alexei V. Alexandrov" <ava@softclub.net> writes:
> Hello everyone,
> 
> i`ve ran into a problem.
> suppose there is a string 1:2:3:4:5
> and there is an expression $expr = " or id = ";
> i have to replace every instance of symbol ":" with $expr;
> standard perl substitute replaces onle the first instance,
> what should i do with other?

add /g modifier. I.e.:

s/:/ or id = /g;

Michal


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

Date: Mon, 19 Oct 1998 13:30:09 -0400
From: Paul White <whitepr@scp1.bellcore.com>
Subject: Resubmitted ... Removing spaces between fields in file records
Message-Id: <362B7721.E8D@scp1.bellcore.com>

Paul White wrote:
> 
> I am trying to write a record to a file
> that is a series of data fields separated
> by commas.
> 
> Unfortunately, spaces " " are inserted into
> every record that I write.
> 
> Here is the code:
> 
> format DATAREC
> @<<<< @<<<< @<<<<<<<<<
> $rec_a, $rec_b, $rec_c
> .
> open (DATAREC,">output.dat");
> for (i=0;i=5:i++){
> $rec_a = "aaaaa" . ",";
> $rec_b = "bbbbb" . ",";
> $rec_c = $rec_a . $rec_b;
> write DATAREC;
> }
> close (DATAREC);
> 
> Here is the output, which I don't want:
>  aaaaa, bbbbb, aaaaabbbbb
>  aaaaa, bbbbb, aaaaabbbbb
>  aaaaa, bbbbb, aaaaabbbbb
>  aaaaa, bbbbb, aaaaabbbbb
>  aaaaa, bbbbb, aaaaabbbbb
>  aaaaa, bbbbb, aaaaabbbbb
> 
> Here is what I want as an output:
> aaaaa,bbbbb,aaaaabbbbb
> aaaaa,bbbbb,aaaaabbbbb
> aaaaa,bbbbb,aaaaabbbbb
> aaaaa,bbbbb,aaaaabbbbb
> aaaaa,bbbbb,aaaaabbbbb
> 
> All comments, suggestions ... welcomed.
> 
> Paul


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

Date: Mon, 19 Oct 1998 15:11:51 GMT
From: eugene@vertical.net
Subject: Re: Shell commands
Message-Id: <70fkrn$6la$1@nnrp1.dejanews.com>

I think he nitpicked the wrong word. People (read Tom Christiansen) like to
insist on the difference between a UNIX system call and Perl system()
command: "chech the system() call" would be wrong, though  "Check the
system() command" is OK.

In article <70emj9$hd1$1@monet.op.net>,
  mjd@op.net (Mark-Jason Dominus) wrote:
>
> In article <GUpW1.23$OZ4.14896@news.shore.net>,
> Nathan V. Patwardhan <nvp@shore.net> wrote:
> >Jason Holland (jason.holland@dial.pipex.com) wrote:
> >
> >: Check the system() command.
> >
> >system() is not a command.
>
> I don't see why not.  I think `command' is a common locution for any
> function or subroutine which is used primarily for its side effects.
> I also think that if you were to study usage in this newsgroup, you'd
> see that that's how people use it:
>
> 	the `system' command
> 	the `print' command
> 	the `mkdir' command
>
> Contrastingly, people never use `command' to indicate functions that
> have no side effects; that is because `command' suggests the
> imperative, and these functions aren't imperative:
>
> 	the `sqrt' command			(*)
> 	the `sort' command			(*)
> 	the `readdir' command			(*)
> 	the `gethostbyname' command		(*)
>
> Anyway, it seems to me that whether or not `command' is correct or
> even common usage in this case, that the meaning here is clear, and to
> complain that `system is not a command' is nitpicking.
>
> It used to drive me nuts when the Pascal programmers would say primly
> `That is not a function.  It is a subroutine.' and they had more of an
> excuse to say that than you do to say that `system' is not a command.
>
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 19 Oct 1998 17:00:11 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Shell commands
Message-Id: <70fr6r$8ju$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, eugene@vertical.net writes:
:I think he nitpicked the wrong word. People (read Tom Christiansen) like to
:insist on the difference between a UNIX system call and Perl system()
:command: "chech the system() call" would be wrong, though  "Check the
:system() command" is OK.

system() is a function that runs a shell command.  syscall()
is a function that runs a system call.  Utterly different beasts.

--tom
-- 
 The use of COBOL criples the mind; its teaching should, therefore, be
 regarded as a criminal offense.         -- E. W. Dijkstra


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

Date: 19 Oct 1998 13:55:52 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Shell commands
Message-Id: <70fuf8$lli$1@monet.op.net>


In article <TpIW1.123$OZ4.38176@news.shore.net>,
Nathan V. Patwardhan <nvp@shore.net> wrote:
>: 	the `print' command
>
>print is a shell built-in as well as a Perl function, right?

Nope.  In the shell, you use `echo', which is usually, but not always
built-in.  

>: 	the `mkdir' command
>
>I don't feel that mkdir(1) and mkdir(2) should be confused.

In all three of these examples, I was referring to the Perl builtin
functions.  So I didn't mean either of mkdir(1) or mkdir(2) here.



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

Date: 19 Oct 1998 11:30:14 -0500
From: monson@tri.sbc.com (Steve Monson)
Subject: Re: Slow Sort?
Message-Id: <70fpem$lr7@euphony.tri.sbc.com>

See ye here Bart Lateur's writings:
>Steve Monson wrote:
>
>> I have performed
>>a few computaional sections, and ended up with a list @s containing
>>102,442 small integers (ranging from 1 to about 100 or so).
>
>which indicates that you have a lot of duplicate values. Maybe this is
>part of the culprit.
>
>And it probably won't give too useful results.
>
>Couldn't you do something like:
>
>	for($i=1;@a<@b;$i++) {
>		push @a, grep { $_ == $i } @b;
>	}
>
>Or similar. It looks like inefficient code, but I'm curious how it
>compares.

Not a bad idea. Actually, I'm sure there are many duplicate values.
But after the sort, I use the result to divide the list up into quartiles
(or n-quantiles for some n), and then display how large a portion of
the raw data belongs in each quantile.

That is, given a grammar, I first compute the frequencies of the words used
in all sentences. Then I compute a weighted sentence "length", where the
weights are the frequencies of the words used in each sentence. These
are then sorted, and the quantiles listed (each with about 28000
sentences), showing what portion of the total words belong in each
quantile. So, duplicate values don't bother me; they just weight
their part of the list more heavily.

Your suggestion of avoiding duplicates is not bad, but at this point,
I'm more interested in why this particular sort, in this particular
application is so slow.

More to come, I'm sure.
Steve Monson
-- 
Common sense is that collection of prejudices which we have acquired
by the age of eighteen.               -- Attributed to Albert Einstein


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

Date: 19 Oct 98 15:28:07 GMT
From: J.Horne@plymouth.ac.uk (John Horne)
Subject: Tables with CGI module
Message-Id: <362b5a87.0@palantir.pbs.plym.ac.uk>

Hi,

I'm using the CGI module within a perl program to create an HTML
table. This works okay, but I have 3 columns which at the moment
are left justified. I'd like the first column to be centered and
the other 2 left justified. How do I do this? I can change the
attributes for the whole line, but don't know how to do this
for each cell. Attempts to set the attribute for each cell in a
td call creates a new row for each cell instead of 3 cells per row.
I.E -     push @table, $q -> td({'-align' => "CENTER"}, "...data...");
          push @table, $q -> td({'-align' => "LEFT"}, "...data...");

A second minor point is that I can't get rid of the cell borders -
again no matter what I do, border=0, bordercolor=..., nothing seems
to shift them. Any ideas?

Thanks for any help,

John.
-----------------------------------------------------------------------------
John Horne                                     E-mail: J.Horne@plymouth.ac.uk
Academic and Information Services              Phone :  +44 (0) 1752 - 233911
University of Plymouth, UK                     Fax   :  +44 (0) 1752 - 233919


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

Date: Mon, 19 Oct 1998 12:20:58 -0500
From: "Marcus J. Foody" <marx@idiom.com>
Subject: Tilde delimited parsing
Message-Id: <362B74FA.28AF@idiom.com>

Hello, I'm trying to parse a tilde delimited text file into a pipe
delimited text file.  It seems some of the fields contain no value but
still need to be accounted for. I'm able to parse the tilde delmited
text file but once the file is parsed(into the pipe delimited file) the
spaces vanish.   

Example of tilde delimited text file:
REC HEAD~016967~~19980728~SAMPLE INSTRUCTIONS

Current result:
REC HEAD|016967|19980728|SAMPLE INSTRUCTIONS

Possible solution:
REC HEAD|016967||19980728|SAMPLE INSTRUCTIONS

Can anyone help
thanks
marcus


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

Date: 19 Oct 1998 19:36:51 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Tilde delimited parsing
Message-Id: <83iuhg4fnw.fsf@vcpc.univie.ac.at>

Re: Tilde delimited parsing, Marcus <marx@idiom.com> said:

Marcus> Hello, I'm trying to parse a tilde delimited text
Marcus> file into a pipe delimited text file.  It seems some
Marcus> of the fields contain no value but still need to be
Marcus> accounted for. I'm able to parse the tilde delmited

Marcus> Example of tilde delimited text file:
Marcus> REC HEAD~016967~~19980728~SAMPLE INSTRUCTIONS

Marcus> Current result: REC HEAD|016967|19980728|SAMPLE INSTRUCTIONS
Marcus> Possible solution: REC HEAD|016967||19980728|SAMPLE INSTRUCTIONS

2 solutions come to mind straight off:

1. if you don't need to parse the content in any way you
   could just use tr/// to bang the ~ into |

    while (<DATA>) {
        tr/~/|/;
        print;
    }
    
    __DATA__
    REC HEAD~016967~~19980728~SAMPLE INSTRUCTIONS

2. if you need to parse it for whatever reasons:

    while (<DATA>) {
        chomp;
        my @fields = split /~/;
        ... do something to @fields ...
        print join('|', @fields), "\n";
    }
    
    __DATA__
    REC HEAD~016967~~19980728~SAMPLE INSTRUCTIONS

TMTOWTDI

hth
tony
-- 
Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien,  | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!  | private email:
    Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>


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

Date: Mon, 19 Oct 1998 13:41:22 -0400
From: Jim Michael <jim.michael@gecm.com>
Subject: Re: Tilde delimited parsing
Message-Id: <362B79C2.3E24@gecm.com>

Marcus J. Foody wrote:
> 
> Hello, I'm trying to parse a tilde delimited text file into a pipe
> delimited text file.  It seems some of the fields contain no value but
> still need to be accounted for. I'm able to parse the tilde delmited
> text file but once the file is parsed(into the pipe delimited file) the
> spaces vanish.
> 
> Example of tilde delimited text file:
> REC HEAD~016967~~19980728~SAMPLE INSTRUCTIONS
> 
> Current result:
> REC HEAD|016967|19980728|SAMPLE INSTRUCTIONS
> 
> Possible solution:
> REC HEAD|016967||19980728|SAMPLE INSTRUCTIONS

You didn't post your code, but something like this should work:

#!/usr/bin/perl -w
$line = 'REC HEAD~016967~~19980728~SAMPLE INSTRUCTIONS';
$line =~ s/~/|/g;
print $line;

E:\>perl test
REC HEAD|016967||19980728|SAMPLE INSTRUCTIONS

Cheers,

Jim


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

Date: Mon, 19 Oct 1998 12:53:32 -0400
From: "Georg Buehler" <gbuehler@NOSPAMmed.unc.edu>
Subject: Re: Trouble scheduling Perl scripts with WinNT AT command
Message-Id: <70fr3g$2t6$1@camel0.mindspring.com>

Scott,

Your cron clone would be exactly what I need . . . if it could run as a
service. Unfortunately, something that only runs when I'm logged in is not
very useful, at least not to me. I need a scheduler that can run jobs when
I'm NOT around in the office . . .

--Georg

scott@softbase.com wrote in message <3627722c.0@news.new-era.net>...
>Georg Buehler (gbuehler@NOSPAMmed.unc.edu) wrote:
>> I've read in the FAQs that folks use the "at" command in WinNT to
schedule
>> events.
>
>UGH! Don't use that piece of junk. I've written a cron clone in perl
>that works great on Windows systems. Go to www.skwc.com/essent
>and scroll down until you get to the free software part.
>
>Scott




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

Date: Mon, 19 Oct 1998 15:55:05 GMT
From: dave@mag-sol.com (Dave Cross)
Subject: Re: What are these?
Message-Id: <362b5eba.1323922@news.demon.co.uk>

On Fri, 16 Oct 1998 12:29:40 -0400, kpreid@ibm.net (Kevin Reid) wrote:

><dave@mag-sol.com> wrote:
>
>> shift - returns the first item of a list and removes it from the list.
>>      e.g. (following on from the last example)
>>           my $thing = shift $list;
>>           puts 'This' in $thing and leaves @list with ('is', 'a', 'list').
>
>s/\$list/\@list/;

Oops. Thanks!

Dave...

dave@mag-sol.com
Sybase Contractors Resource Page: www.mag-sol.com/Sybase/
Agency Rating System: www.mag-sol.com/ARS/
London Perl M[ou]ngers: www.mag-sol.com/London.pm


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

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


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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