[11566] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5166 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 18 13:07:18 1999

Date: Thu, 18 Mar 99 10:00:20 -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           Thu, 18 Mar 1999     Volume: 8 Number: 5166

Today's topics:
    Re: adding a number to an existing value in another fil <hove@ido.phys.ntnu.no>
        Adding elements to hash <donny@impulsesoftware.com>
    Re: Change userid in mid-script <cw@dwc.ch>
    Re: chdir : how do I pass parameters to this function?? (Tad McClellan)
        Crypt-SSLeay modules (yang shen)
    Re: DUMB Newbie question (John Moreno)
    Re: DUMB Newbie question <jeromeo@atrieva.com>
    Re: Filehandle Q... (Tad McClellan)
    Re: find command problem <ealesc@deshaw.com>
    Re: find command problem <blundell@lts.sel.alcatel.de>
    Re: gethostname() <cassell@mail.cor.epa.gov>
    Re: How can I get ALL the content of a HTTP POST, inclu <cw@dwc.ch>
    Re: How do I split an list of text into separate lists  <cassell@mail.cor.epa.gov>
        learn how to hack shadow_merc@my-dejanews.com
    Re: learn how to hack (Tad McClellan)
    Re: Newbe here again... <cassell@mail.cor.epa.gov>
    Re: Not stictly a PERL question <newsgroups@kidkaboom.frogspace.net>
    Re: Oracle Connection (Mick Farmer)
    Re: Perl insert BLOB's (Binary Large Objs) into Oracle? (James Francis)
        perl firstphenomenon@hotmail.com
    Re: perl (Remco Gerlich)
    Re: perl <Allan@due.net>
    Re: Regular Expression Help (Tad McClellan)
    Re: Regular Expression Help (Andrew Johnson)
        Removing white space. <bjandir@hns.com>
    Re: ternary operator <jglascoe@giss.nasa.gov>
    Re: test.pl is running on a local maschine, in www i se (Tad McClellan)
        Variables in QUERY_STRING jt@enterprise.net
    Re: Variables in QUERY_STRING (Tad McClellan)
    Re: Writing to files. (Tad McClellan)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 18 Mar 1999 17:36:51 +0100
From: Joakim Hove <hove@ido.phys.ntnu.no>
Subject: Re: adding a number to an existing value in another file
Message-Id: <k0n1zimrbz0.fsf@ido.phys.ntnu.no>

"TinP" <tgj@snip..net> writes:

 ....
> What I wanted to do was this:
> If the name isn't already in the scores.txt file I want to add the name and
> the score. That is easy enough for me but If the name already exists, I want
> to just add the new value to the current number that is already there. Any
> suggestions on how do that?

Okay, this little program seams to do the job, although I'm not by any
means claiming it is a "perfect" solution:


#!/store/bin/perl -w

open(NEW,"new_file") || die("Could not open $! \n");
@new_list = <NEW>;
close(NEW);
$new_line = join("|",@new_list);
%new_hash = (split(/\s*\|\s*/,$new_line));

# Here we have performed the following operations:
# 1. Opened the file "new_file", and read all the contents into the
#    array @new_list. With one line pr. element in @new_list.
# 
#    @new_list = ("Tom | 4562","Jon | 56",....);
#
# 2. All the elements of @new_list have been joined to a large string
#    in $new_line, with "|" as joining character.
#
#    $new_line = "Tom | 4562|Jon | 56|....";
#
# 3. This large scalar $new_line is split at every "|", possibly
#    surrounded by whitespace, and an assosiative array %new_hash is built:
#
#    $new_hash{"Tom"} = 4562;
#    $new_hash{"Jon"} = 56;
#    ......


open(OLD,"old_file")|| die("Could not open $! \n");
@old_list = <OLD>;
close(OLD);
$old_line = join("|",@old_list);
%old_hash = (split(/\s*\|\s*/,$old_line));

# Same operation for the old file

foreach $key (keys %new_hash) {
    if (defined $old_hash{$key}) {
	$old_hash{$key} += $new_hash{$key};
    } else {
	$old_hash{$key} = $new_hash{$key};
    }
}

# Running through all the elements in %new_hash and updating %old_hash
# accordingly.

open(OLD,">old_list")|| die("Could not open $! \n");
foreach $key (keys %old_hash) {
    print(OLD $key , " | " , $old_hash{$key} ,"\n");
}
close(OLD); 

# Writing it back to file, not pretty, you might want to use a format
# statement to line up the "|".


> Also I was wondering if someone answers my question what is the proper
> netiquette?Should I write back a thanks? Of course I appreciate the help but
> don't want to clog the thread with a useless post of thanks even though I am
> thankful.

I don't know ...


HTH Joakim

-- 
=== Joakim Hove     www.phys.ntnu.no/~hove/    ======================
# Institutt for fysikk	(735) 93637 / 352 GF  |  Skoyensgate 10D    #
# N - 7034 Trondheim	hove@phys.ntnu.no     |	 N - 7030 Trondheim #
=====================================================================


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

Date: Thu, 18 Mar 1999 16:45:30 GMT
From: Donny Widjaja <donny@impulsesoftware.com>
Subject: Adding elements to hash
Message-Id: <36F12E30.7CFFFF22@impulsesoftware.com>

Hi,

I need to add to a couple new elements to the hash from a procedure.
What I have now is 

%Form = qw(a Apple b Boy);
%Form = &addElement;
print $Form{hello}."\n";

sub addElement {
  local ($href) = @_;
  $href->{"hello"} = "world";
  return %$href;
}

The above procedure will get an address reference and return the whole
hash table.  What I want is a procedure that get an address reference
and also return the address
I tried "return $href", but it does not work.  Any body has an idea?

Thank you.


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

Date: Thu, 18 Mar 1999 17:16:59 +0100
From: Christoph Wernli <cw@dwc.ch>
Subject: Re: Change userid in mid-script
Message-Id: <36F126FB.5EE091D7@dwc.ch>

Christoph Wernli wrote:
> 
> I'ld appreciate any pointers/hints on how to change the userid the
> script is executing under in the middle of the script

Sorry, got it. The magic words are $> and $<, respectively.


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

Date: Thu, 18 Mar 1999 04:13:57 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: chdir : how do I pass parameters to this function???
Message-Id: <l4gqc7.jva.ln@magna.metronet.com>

Dillon Savage (dillon@grex.cyberspace.org) wrote:
: It could be because when you get input from <STDIN>, it adds a "\n" to the
: end of the string. 


   No it doesn't.

   Perl doesn't change your data unless you ask it to.

   When you get input from <STDIN> it _has_ a newline at the end.

   It is not "added".


: So when you type "/root," it interprets it as "/root\n,"


   And newlines are most certainly not in the _middle_ of a string
   (assuming the default for $/)


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 18 Mar 1999 17:16:03 GMT
From: ys74@cornell.edu (yang shen)
Subject: Crypt-SSLeay modules
Message-Id: <7crccj$rt6@newsstand.cit.cornell.edu>

Hi everyone,
	Where can I find Crypt-SSLeay modules ?   Thanks!

Yang



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

Date: Thu, 18 Mar 1999 11:08:18 -0500
From: planb@newsreaders.com (John Moreno)
Subject: Re: DUMB Newbie question
Message-Id: <1douz0g.kz4r781fvbpzaN@roxboro0-0004.dyn.interpath.net>

John Callender <jbc@shell2.la.best.com> wrote:

> We can now look forward to several followups in which Tad's approach is
> defended by other experts as being just the sort of "tough love" that
> newbies need if they're ever going to learn.
> 
> Sigh.

I don't know about "tough love" and am certainly no expert -- still I
found it funny (and has a kernel of a answer, careful thought will allow
it to grow into just the answer that was needed).

-- 
John Moreno


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

Date: Thu, 18 Mar 1999 09:25:35 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
Subject: Re: DUMB Newbie question
Message-Id: <36F1370F.4A6D9094@atrieva.com>

David L. Cassell wrote:
> 
> Jerome O'Neil wrote:

> > It is self evident that one cannot debug code that one cannot see.
> 

> Perhaps they have heard of the Telnet::ESP module?

I much prefer Debug::Psychic.  You can chanel it from a CSPAN site near
you.

-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.atrieva.com


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

Date: Thu, 18 Mar 1999 04:04:43 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Filehandle Q...
Message-Id: <bjfqc7.jva.ln@magna.metronet.com>

Rick Osborne (rick@rixsoft.com) wrote:

: Backticks are useful, especially when you want to capture the output.


   Backticks are useful *only* when you want to capture the output.

   system() is useful when you do not need to capture the output.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Thu, 18 Mar 1999 17:16:54 +0000
From: Craig Eales <ealesc@deshaw.com>
Subject: Re: find command problem
Message-Id: <36F13506.C2DBAA08@deshaw.com>

This is probably not the best way..... but I did this a while back on a similar
problem... use the fact that the | is interpreted by the shell so use the exec to
construct the exec strings then pipe them to sh...

in your case

find $path* -name qhelp -exec echo echo \\| {} 2\\>/dev/null \\; | sh

note that we construct the command then pipe it into sh (hence need the two echo
statements)

Craig





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

Date: Thu, 18 Mar 1999 18:11:46 +0100
From: Bernard Blundell <blundell@lts.sel.alcatel.de>
Subject: Re: find command problem
Message-Id: <36F133D2.E970283B@lts.sel.alcatel.de>

Ilya wrote:

> <snip>
>
> $lines = `find $path* -name qhelp -exec echo | {} \\; 2>/dev/null`;
>
> The problem with that is that the "|" (pipe) symbol is being interpreted as
> find command terminator, so when I run this exact command, I get:
>
> ksh: {}:  not found
> find: -exec not terminated with ';'
>
> It thinks the find command ends after the "|" and then the shell tries to
> execute {}, which is of course, not found.
>
> Any tips on how to handle "|" in the find command used in Perl script?
>

Your example includes an demonstration of escaping a command terminator (the
semi-colon). Extend this to your pipe symbol:

$lines = `find $path* -name qhelp -exec echo \\| {} \\; 2>/dev/null`;

Untested, but shouldn't be far off what you're after.

Good luck.

Bern



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

Date: Thu, 18 Mar 1999 09:48:09 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: gethostname()
Message-Id: <36F13C59.94D38959@mail.cor.epa.gov>

Fernando Ariel Gont wrote:
>
> Hullo All , hope you are having a nice day!!

Thank you.  It's quite nice here in Oregon today.

> Hi, is there any other way to get the local host name rather than
> using 'localhost' ?
> 
> I mean, in C there's gethostname()...

Hmm, clearly a polite individual such as yourself must have read
through the perl doc first.  So I'll assume you were overwhelmed
by the immense amount of information and missed it somehow.  It
can happen.

Check the perlfunc manpage/perldoc/html-info that came with
your Perl installation, and you'll find a host [ouch!] of
valuable info on this.  You'll be surprised at the built-ins.
But you don't have to stop there!  Perl also has some extremely
useful modules that can help you do even more.  So zip on over
to CPAN and check it out.  [If you don't know what/where CPAN
is, the info on it is also in your Perl docs.]

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


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

Date: Thu, 18 Mar 1999 17:33:07 +0100
From: Christoph Wernli <cw@dwc.ch>
Subject: Re: How can I get ALL the content of a HTTP POST, including new line?
Message-Id: <36F12AC3.45E8D2F2@dwc.ch>

Claude Bonnard wrote:
> 
> Hello!
> 
> I have a (probably ) basic problem in getting, from a perl script ,
> data which are POSTed from a client.
> 
> In  fact, I gest, using CGI, every "words" I am posting, but NOT the
> "\n"
> 
> 
> I send:
> PROGRAM programname
> DATA LIB base1
> LOWSCORE 10
> BEGIN
> > query sequence to test the parameter extraction
> MNTIKILIGLLGIFLFSLSGIVSAQSDATTQLSQLLSNFRTYQAKF
> 
> the script looks like:
> 
> 
> --------------------------------------------
> #!/usr/local/bin/perl -w
> 
> use CGI;
> my $form = new CGI();
> #check if something is coming back...
> print ($form->header());
> print ('<h1 align=center>Hi!</h1>');
> print ('<hr>');
> print ("\n");
> 
> open (FORM, $blast_form);
> binmode (FORM);
> my $blast_form = new CGI();
> open (FILE, ">/tmp/REQUEST.SAV");
> binmode(FILE);
> $blast_form->save('FILE');
> print ("$blast_form","\n");
> 
> 
> and my result file looks like:
> keywords=PROGRAM
> keywords=progname
> keywords=DATALIB
> keywords=base1
> keywords=LOWSCORE
> keywords=BEGIN
> keywords=%3E
> keywords=query
> keywords=sequence
> keywords=to
> keywords=test
> keywords=the
> keywords=parameter
> keywords=extraction
> keywords=MNTIKILIGLLGIFLFSLSGIVSAQSDATTQLSQLLSNFRTYQAKF
> 
> 
> 
> 
> As you see, the line breaks "\n" are NOT transmitted, apparently, and
> I cannot get the lines as posted :-((
> 
> I do not need to write the POST into a file: I just want to get the
> parameters to start a new program from the script. I thus need to keep
> the organisation of the POSTed data WITH the "\n" in order to select
> the parameters and query!
> 
> Do you know any method to get this (ALL this) in a buffer, a variable
> or somewere?

How exactly are you posting the data ? People are more likely to help
you if you submit a _real_ case of your problem (note the typo in DATA
LIB :)

-w


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

Date: Thu, 18 Mar 1999 09:22:39 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: How do I split an list of text into separate lists of paragraphs
Message-Id: <36F1365F.5D8EDBF5@mail.cor.epa.gov>

Jim Britain wrote:
> On Wed, 17 Mar 1999 10:38:00 -0600, Forrest Reynolds
> <dropzone@mail.utexas.edu> wrote:
> >Hello,
> >    You can switch from processing lines to processing paragraphs by setting $/:
> >
> >local $/ = '';    #sets itself back when you're done
> >
> >       This is explained in the Perl Cookbook p.282,
> >also perlvar(1), "special variables" chap2-camel.
> 
> That's fine for file processing, but how do you apply it for array
> processing?  Remember, the text is already stored in @abstracts
> 
> I always see this discussed for file operations, and have never seen
> it discussed for array operations.

Jim, you're correct.  $/ is $INPUT_RECORD_SEPARATOR .  It doesn't affect
arrays.  Once you have the data in @abstracts, you'll have to use other
techniques to mung^H^H^H^H re-arrange it.

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


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

Date: Thu, 18 Mar 1999 15:55:07 GMT
From: shadow_merc@my-dejanews.com
Subject: learn how to hack
Message-Id: <7cr7km$pk0$1@nnrp1.dejanews.com>

Sup guyz....

	I have been looking at newsgroups for a couple of years now, and I
have noticed that about one in five posts are in reference to "how do I do
this", or where do I get hacker tools.	So to answer these questions, I have
written a text on hacking basics.

	It has a lot of VERY basic things in it, but does contain some
intermediate/advanced techniques also.  Give my site a look:

	http://www.angelfire.com/on/haxoring/index.html

Unfortunately, I didn't spend much time on my webpage  (it sucks)... So bear
with me until I get a REAL one.... ;-)


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


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

Date: Thu, 18 Mar 1999 06:09:12 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: learn how to hack
Message-Id: <osmqc7.vcb.ln@magna.metronet.com>

shadow_merc@my-dejanews.com wrote:

: intermediate/advanced techniques also.  Give my site a look:

: 	http://www.angelfire.com/on/haxoring/index.html


   Don't bother going there.

   That is a commercial website.

   There is no info available there on hacking.


   He also seems to equate "hacking" with "cracking".


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Thu, 18 Mar 1999 09:36:22 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Newbe here again...
Message-Id: <36F13996.244FE901@mail.cor.epa.gov>

Michael de Beer wrote:
> 
> the manpage perlre will tell you.

Well, to be pedantic (as so many of us wish to be :-) the
perlre manpage/perldoc/html-section will tell you pages and
pages of good stuff about regular expressions.. but that may 
be more than you can grok in one sitting.  Look in the docs
on your machine/network for perlfaq6, and read through the
examples there.  If those don't help enough, then consider
buying 'Learning Perl' by Randal Schwartz, which has lots of basic
(and advanced) regex examples.

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


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

Date: Thu, 18 Mar 1999 17:23:39 GMT
From: "Theodore" <newsgroups@kidkaboom.frogspace.net>
Subject: Re: Not stictly a PERL question
Message-Id: <36f136ac.0@news3.escape.ca>

>The old system comprised of the following....
>
>Lynux, Perl, DNS, pop3 services.


You won't want to install NT4 then, you'll want to install Linux instead.

>I was planning on buying a pIII 450, 12Gig HD.  Then install NT4, and PERL
>Win32, Apache (win32) - that I can do, and have done on my own machine
which
>works fine.


Again, don't install NT4, install Linux (get it on CD in  a book) Apache is
more secure on Unix (Linux is Unix) and it comes with Perl

>What DNS stuff do I need, and what pop3 server software is available out
>there.


Can't help you there, sorry

>From Theodore





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

Date: Thu, 18 Mar 1999 16:46:10 GMT
From: mick@picus.dcs.bbk.ac.uk (Mick Farmer)
Subject: Re: Oracle Connection
Message-Id: <F8suKz.3ox@mail2.ccs.bbk.ac.uk>

Dear Ashrof(?),

I suggest using the DBI and DBD::Oracle modules.  Here's a
simple example that I have using the same setup as you.
This assumes that you've set the environment variables
ORACLE_HOME and and TWO_TASK correctly.

Regards,

Mick

8<--------8<--------8<--------8<

use DBD::Oracle;
use DBI;
use strict;

my $db = DBI->connect('dbi:Oracle:', 'example', 'example')
	or die "Can't connect ($DBI::errstr)\n";
my $st = $db->prepare('select * from tab')
	or die "Can't prepare ($DBI::errstr)\n";
$st->execute
	or die "Can't execute ($DBI::errstr)\n";
while (my @field = $st->fetchrow_array) {
	my $row = DBI::neat_list(\@field);
	print "$row\n";
}
$st->finish
	or die "Can't finish ($DBI::errstr)\n";
$db->disconnect
	or die "Can't disconnect ($DBI::errstr)\n";


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

Date: Thu, 18 Mar 1999 10:22:03 -0600
From: uzada@nospam.visi.com (James Francis)
Subject: Re: Perl insert BLOB's (Binary Large Objs) into Oracle?
Message-Id: <MPG.115ae428ba2859b9989681@news.visi.com>

In article <slrn7ds0mp.3al.dhaley@dhcp194.corp.merc.com>, 
dhaley@infobeat.com says...
> Hello,
> 
> I need to store attatchments for an e-mail program into
> our Oracle 7.x database.
> 
> We are using the DBH module for most of out Perl to Oracle
> communication and it works great, except that I heard a programmer
> say that Perl wouldn't transfer files over 250k? into an Oracle
> Long datatype.
> 
> Has anyone heard of this?
> 
> I'm trying to insert a 2MB file into a Long Raw datatype.
> 
> The programmer said he solved the problem by breaking the file
> up into 250k? section and re-assembling it later.
> 
> I'd like to avoid this problem, but I wanted to verify it
> first.
> 
> Thanks in advance
> 
> Damon Haley
> 

use DBI and DBD:Oracle

for more info check out the DBI mailing list or do an altavista search 
for specifics.  using that, you can use something like the following code 
with the key being the bind_param

my $stmt = "update mytable set mylong=? where myid=".$id;

my $sth = $dbh->prepare($stmt);

my $rc = $sth->bind_param(1, $body);

$sth->execute || warn &logError( "execute: ".$dbh->errstr."\n\n", stmt);

-- 
james francis, jafd

**** remove 'nospam' from address for reply ****


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

Date: Thu, 18 Mar 1999 16:31:08 GMT
From: firstphenomenon@hotmail.com
Subject: perl
Message-Id: <7cr9oc$rc3$1@nnrp1.dejanews.com>

i wondered if anyone can help me with this problem ? after installing
activestate win32 perl or something of the sort i was obviously eager to test
this out...therefore i was given the command c:\>netstat -a however, once i
press enter the program instantly terminates can anyone tell me about this
command and why the phenomena is occuring? i have been told that this is not
a perl command but a dos command...but im not sure

thanx

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


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

Date: 18 Mar 1999 16:59:22 GMT
From: scarblac-spamtrap@pino.selwerd.cx (Remco Gerlich)
Subject: Re: perl
Message-Id: <slrn7f2c6l.qgj.scarblac-spamtrap@flits104-37.flits.rug.nl>

firstphenomenon@hotmail.com <firstphenomenon@hotmail.com> wrote:
>i wondered if anyone can help me with this problem ? after installing
>activestate win32 perl or something of the sort i was obviously eager to test
>this out...therefore i was given the command c:\>netstat -a however, once i
>press enter the program instantly terminates can anyone tell me about this
>command and why the phenomena is occuring? i have been told that this is not
>a perl command but a dos command...but im not sure
>
Yup. That's a DOS command alright, shows statistics on your net
connection.

Perl, on the other hand, is a programming language.


-- 
Remco Gerlich   scarblac (a) pino.selwerd.cx
Mail to my From: address is scanned briefly once a week.
The reply-to alias works without change, it is an alias
to check if spam mail is using the Reply-to: header.


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

Date: Thu, 18 Mar 1999 12:04:23 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: perl
Message-Id: <7crbmv$8t4$1@camel29.mindspring.com>

firstphenomenon@hotmail.com wrote in message
<7cr9oc$rc3$1@nnrp1.dejanews.com>...
:i wondered if anyone can help me with this problem ? after installing
:activestate win32 perl or something of the sort i was obviously eager to
test
:this out...therefore i was given the command c:\>netstat -a however, once i
:press enter the program instantly terminates can anyone tell me about this
:command and why the phenomena is occuring? i have been told that this is
not
:a perl command but a dos command...but im not sure

netstat has absolutely nothing to do with perl, it is a DOS utility shows
the status of your TCP and UDP connections.   If you don't have any (ie if
you are not connected to a network or the net) then there is nothing for
netstat to report.  As an asside, I would strongly suggest that you refrain
from executing commands when you don't know what they are supposed to do.

HTH

AmD

--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
I'd rather have a free bottle in front of me than a prefrontal lobotomy.
 - Fred Allen





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

Date: Thu, 18 Mar 1999 04:09:38 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Regular Expression Help
Message-Id: <isfqc7.jva.ln@magna.metronet.com>

Philip Newton (Philip.Newton@datenrevision.de) wrote:
: Gala Grant wrote:
: > 
: > "c:\\web\\content\\tbuedit\\alpha\\tools\\pressroom\\releases\\"

: Hmm, this has nothing to do with the question, but... did you know that
: you can also use '/' as a path separator, even on Windows systems? That
: way you avoid having to double your backslashes all the time. For
: example, C:\\web\\content is the same as C:/web/content . Looks cleaner
: IMHO.


   Or, using a quoting mechanism where you don't need to escape
   the escapes in the first place:

      'c:\web\content\tbuedit\alpha\tools\pressroom\releases\';


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Thu, 18 Mar 1999 16:56:50 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Regular Expression Help
Message-Id: <mfaI2.607$rL2.1989@news1.rdc1.on.wave.home.com>

In article <isfqc7.jva.ln@magna.metronet.com>,
 Tad McClellan <tadmc@metronet.com> wrote:
! Philip Newton (Philip.Newton@datenrevision.de) wrote:
! : Gala Grant wrote:
! : > 
! : > "c:\\web\\content\\tbuedit\\alpha\\tools\\pressroom\\releases\\"
! 
! : Hmm, this has nothing to do with the question, but... did you know that
! : you can also use '/' as a path separator, even on Windows systems? That
! : way you avoid having to double your backslashes all the time. For
! : example, C:\\web\\content is the same as C:/web/content . Looks cleaner
! : IMHO.
! 
! 
!    Or, using a quoting mechanism where you don't need to escape
!    the escapes in the first place:
! 
!       'c:\web\content\tbuedit\alpha\tools\pressroom\releases\';

don't forget that the backwack does escape the quoting delimiter in
single quoted strings---so the final quote in your example is escaped
unless you double the last backwack. I think '/' is just cleaner.

regards
andrew



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

Date: Thu, 18 Mar 1999 12:29:02 -0500
From: Brahmdeep Jandir <bjandir@hns.com>
Subject: Removing white space.
Message-Id: <Pine.SO4.4.05.9903181224110.9371-100000@msatsun64.hns.com>

I am sure this has been asked at least a million times .... but please bear 
with me.

$text =~ s#^\s*(.*)\s*$#$1#;
$text =~ s#(.*)\s*$#$1#;

Will the two above statements remove the white space at the end of the 
string or not ??
They do not for me ! Why ??

Thank you in advance.

Brahmdeep.




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

Date: Thu, 18 Mar 1999 12:23:46 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
Subject: Re: ternary operator
Message-Id: <36F136A2.279EF32D@giss.nasa.gov>

[courtesy copies of post sent to 23_skidoo and Larry Rosler]

<blush> Thanks to Larry Rosler for correcting me on this:

Jay Glascoe wrote:
> 
> 23_skidoo wrote:
> >
> > $secondVar = ($firstVar == 0) ? 0 : $array[0];
> > $secondVar = $firstVar ? $array[0] : 0;
> 
> $secondVar = $firstVar || $array[0];  # probably best style
> $secondVar = $firstVar or $secondVar = $array[0];  # a bit silly
> $secondVar = $array[0] unless $secondVar = $firstVar;  # sillier still

$secondVar = $firstVar && $array[0];
$secondVar = $firstVar and $secondVar = $array[0];
$secondVar = $array[0] if $secondVar = $firstVar;

Guess I got the logic wrong on my first answer, then
wrote the rest based on the first...

but then, curiously, I write:

> if ($firstVar) { $secondVar = $array[0] } else { $secondVar = $firstVar }

hmm.  Guess I was just majorly whacked out after all.  ;^) 

	Jay Glascoe
-- 
\$beer;  # a reference to beer
  --seen on the NY.pm mailing list


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

Date: Thu, 18 Mar 1999 04:47:19 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: test.pl is running on a local maschine, in www i see the only the source
Message-Id: <73iqc7.jva.ln@magna.metronet.com>

Andy Rundholz (rundholz@wabe.de) wrote:

: my programm test.pl is running like a rabbit on a local maschine. /:-)
: but if i call the programm from a webserver i see only the source code?


   Perl FAQ, part 9:

      "My CGI script runs from the command line but not the browser.
       (500 Server Error)"


   You have a server configuration issue.

   That type of thing is discussed in a newsgroup that is in
   some way connected to servers.

   This newsgroup is not one of those.


      comp.infosystems.www.authoring.cgi
      comp.infosystems.www.servers.mac
      comp.infosystems.www.servers.misc
      comp.infosystems.www.servers.ms-windows
      comp.infosystems.www.servers.unix


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Thu, 18 Mar 1999 16:16:23 GMT
From: jt@enterprise.net
Subject: Variables in QUERY_STRING
Message-Id: <36f2244e.22767897@news.enterprise.net>

I wonder if anyone out there can help

I need to send the server a QUERY_STRING dependent upon where the the
user clicks on an image map.

Is it possible to use the FORM GET method to send something like

href=www.domain.com/cgi-bin/prog.cgi?fieldname=variable

???

Thanks

jt


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

Date: Thu, 18 Mar 1999 06:09:57 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Variables in QUERY_STRING
Message-Id: <5umqc7.vcb.ln@magna.metronet.com>

jt@enterprise.net wrote:
: I wonder if anyone out there can help

: I need to send the server a QUERY_STRING dependent upon where the the
: user clicks on an image map.

: Is it possible to use the FORM GET method to send something like

: href=www.domain.com/cgi-bin/prog.cgi?fieldname=variable


   What is your Perl question?


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Thu, 18 Mar 1999 04:42:58 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Writing to files.
Message-Id: <2rhqc7.jva.ln@magna.metronet.com>

Steven Filipowicz (s.filipowicz@orades.nl) wrote:

: I would love to know how I can write something to a file.

: For example I would like to write $number and $name to a file.
: How would I do this?


   You would read about the open() function in the docs that
   are included with perl (perlfunc.pod).

   The second paragraph describes how to open a file for writing.

   There is example code there as well.


   Use the docs Luke.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

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


Administrivia:

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

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

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

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

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

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 5166
**************************************

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