[8365] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1982 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 26 18:08:11 1998

Date: Thu, 26 Feb 98 15:00:33 -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, 26 Feb 1998     Volume: 8 Number: 1982

Today's topics:
    Re: "Learning Perl" questions and frustrations <stanier@neuma.com>
        "Or" Operator? <rxruck2@uswest.com>
    Re: "Or" Operator? <dcameron@nospam.bcs.org.uk>
    Re: "Or" Operator? (Juergen Heinzl)
    Re: "Or" Operator? <df6954@eecs1.eecs.usma.edu>
    Re: @array troubles <barnett@houston.Geco-Prakla.slb.com>
    Re: [QUES} Perl Win95 <ekristia@email.unc.edu>
    Re: better way to do this? <tchrist@mox.perl.com>
        boston PUG (was Regional PUGs) <uri@sysarch.com>
        Concurrent access to Berkely DB files problem (Daniel Austin)
    Re: Cookie with Perl (Steve Linberg)
    Re: dbm file format? <dcameron@nospam.bcs.org.uk>
        Help: Perl CGI & Database (Timothy P O'Neill)
    Re: Help:What is current directory in Perl CGI? (Craig Berry)
    Re: Install of tk800.000.gz tkperl (Stefaan A. Eeckels)
    Re: INTERNAL SERVER ERROR - Help??? (JackE)
    Re: Musings on English.pm (Ilya Zakharevich)
    Re: ODBC.pm and Fetch() (Steve Linberg)
    Re: print and the trinary ?: uri@sysarch.com
    Re: print and the trinary ?: <prl2@lehigh.edu>
    Re: print and the trinary ?: <dboorstein@shopcfn.com>
    Re: print and the trinary ?: (Earl Hood)
    Re: print and the trinary ?: <barnett@houston.Geco-Prakla.slb.com>
    Re: proper filename extensions (Andy Lester)
    Re: Splitting on 2 line feeds? (Martien Verbruggen)
    Re: The Ineffable Tom C. (Billy Chambless)
    Re: The Ineffable Tom C. (Kenneth Herron)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Thu, 26 Feb 1998 16:06:23 -0500
From: "jeff stanier" <stanier@neuma.com>
Subject: Re: "Learning Perl" questions and frustrations
Message-Id: <6d4lph$b1s$1@news.intranet.ca>

You can check the version of PERL by typing "perl -v" at the shell prompt.

Jeff Stanier




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

Date: Thu, 26 Feb 1998 14:31:08 -0600
From: Ryan Rucker <rxruck2@uswest.com>
Subject: "Or" Operator?
Message-Id: <34F5D10C.291C0B5F@uswest.com>

Hello,

I'm new to programming in general and perl specifically.  Here's a basic
statement I'm having a problem with.

Consider this if statement:

     if ($var1 ne 'value1' || $var1 ne 'value 2') {
               print ('$var1 is not equal to value 1 or value 2',"\n");
   } else {
              print ('$var 1 is equal to either value 1 or value 2',
"\n");
 }

I having problems when perl evaluates $var1.  With this if statement,
even when $var1 is equal to either value 1 or value 2, it won't drop
through to the else portion.  Instead, it executes the first print
statement.

I think this has something to do with the || operator, but I don't know
a way around it.

I'd sure appreciate any help any of you can provide.

Thanks,

Ryan



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

Date: 26 Feb 1998 20:59:09 GMT
From: "Duncan Cameron" <dcameron@nospam.bcs.org.uk>
Subject: Re: "Or" Operator?
Message-Id: <01bd42f9$5050bb80$e63163c3@dns.btinternet.com>

Er....

Is this a hoax?  It's the most basic way of getting a compound conditional
wrong.  ANY value of $var1 will either not equal 1 or will not equal 2
(think about it).

You want AND or ,more clearly invert the condition,

if ($var1 eq 'value1' or $var1 eq 'value2') ....

HTH
-- 
Remove 'nospam.' to get my return address.

Ryan Rucker <rxruck2@uswest.com> wrote in article
<34F5D10C.291C0B5F@uswest.com>...
>SNIP
> Consider this if statement:
> 
>      if ($var1 ne 'value1' || $var1 ne 'value 2') {
>                print ('$var1 is not equal to value 1 or value 2',"\n");
>    } else {
>               print ('$var 1 is equal to either value 1 or value 2',
> "\n");
>  }
> 
> 


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

Date: 26 Feb 1998 21:28:44 GMT
From: juergen@unicorn.noris.de (Juergen Heinzl)
Subject: Re: "Or" Operator?
Message-Id: <slrn6fbo0e.3s.juergen@unicorn.noris.de>

In article <34F5D10C.291C0B5F@uswest.com>, Ryan Rucker wrote:
>Hello,
>
>I'm new to programming in general and perl specifically.  Here's a basic
>statement I'm having a problem with.
[...]
>     if ($var1 ne 'value1' || $var1 ne 'value 2') {
[...]
I guess you just forgot a space here ?
>               print ('$var1 is not equal to value 1 or value 2',"\n");
>   } else {
>              print ('$var 1 is equal to either value 1 or value 2',
>"\n");
> }
>
>I having problems when perl evaluates $var1.  With this if statement,
>even when $var1 is equal to either value 1 or value 2, it won't drop
>through to the else portion.  Instead, it executes the first print
>statement.

Well, of course. If $var1 is 'value 1', then the expression is true,
finally it is not 'value 2' and the same the other way round.

So you might use && ...
if ($var1 ne 'value 1' && $var1 ne 'value 2')
 ... here.

Bye, Juergen

-- 
\ Real name     : Juergen Heinzl     \       no flames      /
 \ EMail Private : unicorn@noris.de   \ send money instead /
  \ Phone Private : +49 911-4501186    \                  /


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

Date: Thu, 26 Feb 1998 16:21:53 -0500
From: "Dr. Frank J. Mabry, Jr." <df6954@eecs1.eecs.usma.edu>
Subject: Re: "Or" Operator?
Message-Id: <34F5DCF1.5032@eecs1.eecs.usma.edu>

Ryan Rucker wrote:
> 
> Hello,
> 
> I'm new to programming in general and perl specifically.  Here's a basic
> statement I'm having a problem with.
> 
> Consider this if statement:
> 
>      if ($var1 ne 'value1' || $var1 ne 'value 2') {
>                print ('$var1 is not equal to value 1 or value 2',"\n");
>    } else {
>               print ('$var 1 is equal to either value 1 or value 2',
> "\n");
>  }
> 
> I having problems when perl evaluates $var1.  With this if statement,
> even when $var1 is equal to either value 1 or value 2, it won't drop
> through to the else portion.  Instead, it executes the first print
> statement.
> 
> I think this has something to do with the || operator, but I don't know
> a way around it.
> 
> I'd sure appreciate any help any of you can provide.
> 
> Thanks,
> 
> Ryan

I believe your logic is in error.  If $var1 is equal to 'value 1'
then the left portion of the statement is false which causes 
evaluation to continue with the logic on the right where 
the evaluation compares $var1 (which is 'value 1') to be 
compared with 'value 2' which it is not equal to, the
logic evaluates to true and the first print statement is executed.

There is no value that $var1 can have that will cause execution 
to process the second print statement.  I might have something 
backwards myself but I think that is the source of the problem
no a misunderstanding of the "or" operator.
 
-- 
Dr. Frank J. Mabry, Jr.
Dept. of Elec. Eng. & Comp. Sci.
U.S. Military Academy
West Point, NY 10996

Email: df6954@eecs1.eecs.usma.edu
Phone: (914)-938-2960


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

Date: Thu, 26 Feb 1998 12:36:32 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: @array troubles
Message-Id: <34F5B630.5C7BA663@houston.Geco-Prakla.slb.com>

Mukund Rao wrote:
> 
> Hello. I'm receiving a web-form submission containing multiple words:
> 
> $ITEM = $in{'ITEM'};    # $ITEM contains "hello there"
> 
Why do this?  Now you have $ITEM which is hello there, and $in{'ITEM'}
which is also hello there.

> I would like to extract just the 1st word or just the 2nd word, and am
> trying to do so via this method:
> 
> @array = $ITEM;
Assign the right side comma-seperated list context to the left side
array.  Since there is only one value there, you get a one element
array.

Look up the split command.

Perhaps you mean something like:
@array = (split(/ /,$in{'ITEM'});
> print $array[1];   # which should print out "there".
It should now.

> 
> However, I am only able to print out contents of $array[0] which contains
See above comments.

> "hello there". Could you please give me some advice as to how to break up
> $ITEM into an array and extract the elements as above. I don't think my
> syntax is working properly.
> 
> Thank you -- please address email to me as "mrao@trincoll.edu"
> 
<snip>

Dave

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------


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

Date: Thu, 26 Feb 1998 16:34:27 -0500
From: "Erik Kristiansen" <ekristia@email.unc.edu>
Subject: Re: [QUES} Perl Win95
Message-Id: <6d4naf$dkm$1@fddinewz.oit.unc.edu>

What type of Web server are you using? I use MS PWS 1.0. You have to
associate the perl.exe to .cgi and .pl in the windows registry with this
package. I took about two weeks of headaches to get my setup completely
right.

Erik P. Kristiansen
Enterspace, Inc.
www.es2000.com

rschafe wrote in message <34F592F8.15F2@nbnet.nb.ca>...
>Does anyone out there have any experience with using perl in a
>Windows 95 environment. Everything in the script and html code
>seem right, but for some reason when the Netscape browser runs
>the cgi file it finds the .cgi file but will not execute the
>Perl script in there. Yet running the perl script through DOS
>shell and the script works fine. :(
>
>It is as if it cannot find the perl.exe. My question is has anyone
>else run into this problem and do you not of any bug that might
>be causing this (wetware or software related)?
>
>I am currently using a copy of PERL5 from the SAMS "Learn Perl
>for Windows NT" book.
>
>Thanks in advance.
>
>SC




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

Date: 26 Feb 1998 21:12:13 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: better way to do this?
Message-Id: <6d4lrd$gq0$1@csnews.cs.colorado.edu>

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

I was making the point that using star to mean any is a bad idea.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    echo "Congratulations.  You aren't running Eunice."
        --Larry Wall in Configure from the perl distribution


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

Date: 26 Feb 1998 16:55:16 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: boston PUG (was Regional PUGs)
Message-Id: <x7sop6116j.fsf@sysarch.com>

Holly Sommer <hsommer@micro.ti.com> writes:

> PUG - Perl User Groups.
> 
> I was wondering if there are any such beasties out there... and if not,
> whether there might be interest in forming any as such.
> 
> -Holly
> -- 
> My opinions do not necessarily reflect those of my employer.

there is a new york group called /New York Perl M((o|u)ngers|aniacs)*/.
they have a web site http://ny.pm.org/

i am trying to start one in the boston area. i have a small list of 4
who are interested. we haven't had our first meeting yet. anyone out
there in the boston area is invited to contact me about a boston area
perl group.

thanx,

uri

-- 
Uri Guttman                     SYStems ARCHitecture and Software Engineering
uri@sysarch.com                                          Have Perl, Will Hack
http://www.sysarch.com                (781) 643-7504 x*2  FAX: (781) 643-2710
Try the Best Search Engine on the Net -------->  http://www.northernlight.com


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

Date: 23 Feb 1998 08:53:51 GMT
From: dan@spirit.net.au (Daniel Austin)
Subject: Concurrent access to Berkely DB files problem
Message-Id: <6crdev$1l4$1@goliath.spirit.net.au>

I'm trying to write a wrapper for Berkely DB file access - the
most important addition being the implementation of file locking so
that concurrent processes and read/write to the same file without
clobbering each others changes.

The module is based on part of another project and also includes the
file locking example found in the camel book (2nd ed). My test program
forks off two children. Each child opens the same DB file using the
module, and then creates 100 records each (the first child numbers
its records from 1 to 100, the second from 101 to 200). When the
two children finish and close the file, there *should* be 200
records in the file, but the actual number varies. I thought my
file locking routines would handle this -- before unlocking a file
I do a $dbhandle->sync() call to make sure all changes are flushed
but I still lose up to 100 records in the final count.

I wasn't sure if it was appropriate to post code here, at least
in this case, so I've got a minimal test case at
        http://avoca.austlii.edu.au/~dan/perl/

If you install BaseData.pm in a directory called 'AustLII' and
install baseseq.pl in the directory below that you should be able
to see the problem. 200 records should be created when you run
the program, but only 100-111 are typically found at the end of the
test. I don't like asking strangers to volunteer to debug my own
code but I've exhausted my man page and other on-line resources.
I've fixed a few things that I was doing wrong (there must be others)
but am still stuck with this bug (oh no!).

I'm hoping there's someone out there with a better understanding
of Berkeley DB, file locking and Perl modules/objects/references
in general. I've tested this on Solaris and FreeBSD both using
Perl 5.004 (patch level 4). Can anyone take a quick look and report
on anything obvious for me? Please!? :-)

This group's traffic is way too high for me to keep up with,
since I have limited USENET resources. But if I get a fix by
e-mail I'll post a solution back to the 'net and make the code
generally available.

Dan



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

Date: Thu, 26 Feb 1998 15:44:42 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Cookie with Perl
Message-Id: <linberg-2602981544420001@projdirc.literacy.upenn.edu>

In article <6d3uh4$kr6$3@csnews.cs.colorado.edu>, tchrist@mox.perl.com
(Tom Christiansen) wrote:

> In comp.lang.perl.misc, 
>     "Martin" <koala1998@hotmail.com> writes:
> :I have written a perl script to expire a cookie.  But when i pressed the
> :back button on the browser, the cookie is set back to its origianl value.
> :Anyone experienced that?  Can somebody help?
> 
> Sure, people on a newsgroup pertaining to the web.  This one, you
> will soon notice, does not.  Also, read Abigail's do con the 
> back button and its futility.                     ^^ ^^^

Funny how a simple typo can befuddle an otherwise mostly normal brain. 
What the hell is a "do con"?  Ah, he said after five minutes of
back-burner braincell burning, he meant "doc on". D'oh-pe slap.

And for the deja-news impaired, the URL is:

<http://cthulhu.mandrake.net/%7Eabigail/HTML/Misc/back_button.html>

-- 
Steve Linberg                  |    National Center on Adult Literacy
Systems Programmer etc.        |           University of Pennsylvania
linberg@literacy.upenn.edu     |        http://www.literacyonline.org


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

Date: 26 Feb 1998 21:17:18 GMT
From: "Duncan Cameron" <dcameron@nospam.bcs.org.uk>
Subject: Re: dbm file format?
Message-Id: <01bd42fb$d8a10e20$e63163c3@dns.btinternet.com>

If I understand your question correctly, you create the files within your
Perl program as so

$filename = 'testdb.xxx';
tie %hash, "SDBM_File", $filename, O_RDWR|O_CREAT, 0644;

this just worked for me and created testdb.xxx.dir and testdb.xxx.pag

HTH
-- 
Remove 'nospam.' to get my return address.

Kevin B Cohen <kcohen@julius.ling.ohio-state.edu> wrote in article
<6d4cov$rna@julius.ling.ohio-state.edu>...
> hi,
> 
> having looked in the blue camel, and the blue llama, and sniffed about
> in the man pages/faq's, i can't quite figure out how you go about
> making the files that get used by the dbmXXX functions.  i read on the
> "Perl for Win32" faq's that "DBM files are "binary"", so i don't guess
> i'm just going to be creating a couple of text files..... do i need to
> write a script to do the initial creation of the files???
> 
> kevin
> 
> 


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

Date: 26 Feb 1998 19:17:16 GMT
From: timothy@nmia.com (Timothy P O'Neill)
Subject: Help: Perl CGI & Database
Message-Id: <6d4f3s$9l1@hume.nmia.com>

Hello -

I'm having a hell of a time with a project involving multiple folks
communicating via CGI's nearly real-time.

I have two questions:
1) Does it seem possible that a heavily-taxed web server would lose CGI
parameters (POST method) passing to the CGI?
2) If many people are hitting the same databases, when will there be
conflict? I've assumed that reading from the database is always safe, and
that one only needs to rigidly control access when writing. To do so, I've
got this routine :

sub SetValue {
   local($DBName);
   local($DBField);
   local($DBValue);
   local($DBdir);
   local ($DBpag);
   $DBName = $_[0];
   $DBField = $_[1];
   $DBValue = $_[2];
   $DBdir = $DBName.".dir";
   $DBpag = $DBName.".pag";
   open(DBdir,">>$DBdir");
   open(DBpag,">>$DBpag");
   flock $DBdir, $LOCK_EX;
   flock $DBpag, $LOCK_EX;
   dbmopen(%DATABASE, $DBName, 0600);
   $DATABASE{$DBField} = $DBValue;
   dbmclose(%DATABASE);
   flock DBdir, $LOCK_UN;
   flock DBpag, $LOCK_UN;
   close (DBdir);
   close (DBpag);
   return 1;
}

Yeah, it's ugly, but I hoped it would prevent conflicts when 20 people may
be trying to update the same database simultaneously. Are there better
ways to do this? Will this in fact catch conflicts?

thanks lots

+---------------------------------------------------------------------+
|                   Timothy O'Neill Dang/Cretog8                      |
+--------------+------------------------------------------------------+
| 505-843-6966 | timothy@nmia.com |    http://www.nmia.com/~timothy/  |
+--------------+------------------+-----------------------------------+
|                   One monkey don't stop no show                     |
+---------------------------------------------------------------------+



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

Date: 26 Feb 1998 19:55:08 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Help:What is current directory in Perl CGI?
Message-Id: <6d4hat$3n8$1@marina.cinenet.net>

Craig (craig@skybound.demon.nl) wrote:
: I wrote a Perl CGI script, but the current directory when searching for
: files is not the scripts directory, but the directory of the web server.
: Is this always so? 

More often than not, on NT servers.  This caused me no end of pain before 
I finally learned to live with it, and figured out how to deal with it.

: Is it possible to retrieve the current directory?

perldoc Cwd

However, a 'use libs _path_' where _path_ is the absolute path to your
scripts directory is often a better bet.  If you're also accessing data 
files in (or relative to) that dir, then put 'chdir _path_' near the top 
of your script as well.

Best of luck!

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: 26 Feb 1998 22:09:27 GMT
From: Stefaan.Eeckels@ecc.lu (Stefaan A. Eeckels)
Subject: Re: Install of tk800.000.gz tkperl
Message-Id: <6d4p6n$dlj$2@justus.ecc.lu>

In article <34F5A9ED.43B83DC4@mail.mcoe.k12.ca.us>,
	Joseph Norris <sirron@mail.mcoe.k12.ca.us> writes:
> I get the following:
> 
> /usr/bin/perl -I./blib/arch -I./blib/lib demos/widget
> TRANS(SocketUNIXConnect) () can't connect: errno = 111
> couldn't connect to display ":0" at blib/lib/Tk/MainWindow.pm line 54.
> MainWindow->new() at demos/widget line 21
> make: *** [test_dynamic] Error 111
> 
> Any ideas about where I am going wrong?
It looks like your X server isn't running, or if it's running,
it's not known as ':0' (the shorthand for the local display
on a Un*x box). You should have a DISPLAY variable indicating
the name of your display.
I see you're posting from a Windows95 box - have you got a
X emulator running and correctly configured? 

Stefaan
-- 

PGP key available from PGP key servers (http://www.pgp.net/pgpnet/)
___________________________________________________________________
  "Don't worry about people stealing your ideas.  If your ideas
   are any good, you'll have to ram them down people's throats."
                                                -- Howard Aiken


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

Date: Thu, 26 Feb 1998 11:04:36 -0800
From: jacke@hghed_dot_com.die-spambot-die (JackE)
Subject: Re: INTERNAL SERVER ERROR - Help???
Message-Id: <jacke-2602981104370001@dnai-207-181-206-17.dialup.dnai.com>

Specifically, try "perl -c yourcgi.cgi" at the command line, and you will
be enlightened!


In article <34F5A5ED.B9A2CF90@west.net>, John Callender <jbc@west.net> wrote:

> Pat Schmitt wrote:
> > 
> > I received an INTERNAL SERVER ERROR while attempting to run the
> > following
> > script:
> 
> etc...

> * what happens when you try to execute the script from the command line,
> rather than from a browser?
> 
> * what appears in your Web server's error log when you try to invoke the
> script from a browser?
>

-- 
Jack Ellis
<jacke@hghed_dot_com.die.spambot.die>
pgp key at http://ccme.org/jackepgp.txt


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

Date: 26 Feb 1998 22:44:15 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Musings on English.pm
Message-Id: <6d4r7v$i4e$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to 
<schwern@starmedia.net>],
who wrote in article <6d48mp$okd$1@nnrp2.dejanews.com>:
> So English.pm has been lambasted for its causing program-wide regex
> inefficiencies (because it mentions $&, $` and $').  I think I may have a way
> to avoid that little unpleasentness while still keeping $MATCH, $POSTMATCH and
> $PREMATCH available...
> 
> Why not make *MATCH, et al. a tied variable?  The FETCH routine would use eval
> to cause $& not to be mentioned until $MATCH is actually used.  

Too late.  The harm is already done - the m/blah/ was already executed
at this moment, and $& was not set, since perl did not see why it
should do so.

Ilya


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

Date: Thu, 26 Feb 1998 15:39:05 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: ODBC.pm and Fetch()
Message-Id: <linberg-2602981539050001@projdirc.literacy.upenn.edu>

In article <34F30F6C.3FAC@hp.com>, bob_barthelow <bob_barthelow@hp.com> wrote:

> I am using the 970208 version of ODBC.pm and am uncertain if this
> supports only SQLExtendedFetch() or if SQLFetch() is still available.
> The ODBC driver I must use does not support SQLExtendedFetch(). Does
> anyone know?

As far as I can recall from the documentation (which you read, I assume?),
Win32::ODBC uses SQLFetch() if you call FetchRow without parameters, and
SQLExtendedFetch() if you call FetchRow with parameters.  And it mentions
that the API explicitly warns against doing it both ways - pick a way and
go with it.

-- 
Steve Linberg                  |    National Center on Adult Literacy
Systems Programmer etc.        |           University of Pennsylvania
linberg@literacy.upenn.edu     |        http://www.literacyonline.org


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

Date: 26 Feb 1998 13:58:40 -0500
From: uri@sysarch.com
Subject: Re: print and the trinary ?:
Message-Id: <x7u39m19cv.fsf@sysarch.com>

"Phil R Lawrence" <prl2@lehigh.edu> writes:

> I want to say:
> print "  action:         ", ($action eq "update") ? "update" : "purge";
> 
> but perl chokes on all the "s.  Any ideas how to do this?  I'd hate to use
> more than 1 line to do it.

works fine for me as is. could you be more specific as what you are
seeing as errors, etc.

also use single quotes (') for fixed strings with no need for
interpolation. it's more semantically correct and would simplify you
quoting (non-)problems.

uri


-- 
Uri Guttman                     SYStems ARCHitecture and Software Engineering
uri@sysarch.com                                          Have Perl, Will Hack
http://www.sysarch.com                (781) 643-7504 x*2  FAX: (781) 643-2710
Try the Best Search Engine on the Net -------->  http://www.northernlight.com


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

Date: Thu, 26 Feb 1998 14:05:07 -0500
From: "Phil R Lawrence" <prl2@lehigh.edu>
Subject: Re: print and the trinary ?:
Message-Id: <6d4ed3$1qtk@fidoii.cc.Lehigh.EDU>

The problem was caused by something else.  The following turned out to work
fine:

print "  ACTION:         ", ($action eq "update") ? "update\n" : "purge\n";

results in:
  ACTION:         update

or
  ACTION:         purge

Thanks!






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

Date: Thu, 26 Feb 1998 14:19:02 -0500
From: Dan Boorstein <dboorstein@shopcfn.com>
Subject: Re: print and the trinary ?:
Message-Id: <34F5C026.50CC02AF@shopcfn.com>

Phil R Lawrence wrote:
> 
> I want to say:
> print "  action:         ", ($action eq "update") ? "update" : "purge";
> 
> but perl chokes on all the "s.  Any ideas how to do this?  I'd hate to use
> more than 1 line to do it.

hmm, your code works as is for me. it does warn about $action being
used once and uninitialized, but the end result is that it prints:

  action:         purge

could it be something else? could you isolate a snippet that still
fails? maybe you have a missing quote elsewhere.

good luck,

--
#!/usr/bin/perl -w -- 2 for 1    dan boorstien <dboorstein@shopcfn.com>
# my first Just another Perl hacker,
seek DATA,0,0;{$_=<DATA>,/!/&&redo}print join(' ',(split)[3..6])__END__
# my second Just another Perl hacker,


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

Date: 26 Feb 1998 19:56:28 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: print and the trinary ?:
Message-Id: <6d4hdc$6mq@news.service.uci.edu>

	[mail and posted]
In article <6d4ao2$qdk@fidoii.cc.Lehigh.EDU>,
Phil R Lawrence <prl2@lehigh.edu> wrote:
>I want to say:
>print "  action:         ", ($action eq "update") ? "update" : "purge";
>
>but perl chokes on all the "s.  Any ideas how to do this?  I'd hate to use
>more than 1 line to do it.

The statement you list works for me.  Your error probably has to
do with some preceding statements.  Maybe an unclose double-quote
somewhere.  Check the error messages closely that perl generates.
It is usually pretty good at denoting where the error lies (especially
with potential runaway strings).

	--ewh
-- 
             Earl Hood              | University of California: Irvine
      ehood@medusa.acs.uci.edu      |      Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME


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

Date: Thu, 26 Feb 1998 15:51:51 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: print and the trinary ?:
Message-Id: <34F5E3F7.31F43D7A@houston.Geco-Prakla.slb.com>

Phil R Lawrence wrote:
> 
> I want to say:
> print "  action:         ", ($action eq "update") ? "update" : "purge";
> 
> but perl chokes on all the "s.  Any ideas how to do this?  I'd hate to use
> more than 1 line to do it.
> 
It does???

I ran your bit of code above, and it printed either update, or purge,
depending on whether $action was update, or something else.  My perl:
5.004_01 

My test:

#!/usr/local/bin/perl -w
$action = "update";
print "  action:         ", ($action eq "update") ? "update" : "purge";
print "\n";
__END__

output:
  action:         update
when $action set to update

output:
  action:         purge
when $action set to noupdate

What error does perl issue when it 'chokes'?

>
<snip>

Dave

--

"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------


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

Date: 26 Feb 1998 19:44:17 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: proper filename extensions
Message-Id: <6d4gmh$lv2$1@usenet11.supernews.com>

: I know I've seen recommendation to use .plx(PerL eXecutable?) on
: platforms that require an extension(rather than an execute bit), and

I use .plx for scripts that should run through the ActiveState ISAPI-based
Perl, and .pl for ones that require the CGI version.  This is on a web
server, natch.

xoxo,
Andy




--
--
Andy Lester:        <andy@petdance.com>       http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com>  http://ChicagoMusic.com/



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

Date: 26 Feb 1998 22:15:09 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Splitting on 2 line feeds?
Message-Id: <6d4phd$886$1@comdyn.comdyn.com.au>

In article <6d438c$qpa$1@csnews.cs.colorado.edu>,
	Tom Christiansen <tchrist@mox.perl.com> writes:
>  [courtesy cc of this posting sent to cited author via email]
> 
> In comp.lang.perl.misc, 
>     mgjv@comdyn.com.au (Martien Verbruggen) writes:
>:my (@CHUNKS) = split (/\n\n/s, @DATA);
> 
> Why are you splitting on the number of elements in the
> array?  I promise you that there won't be newline pairs in 
> the 23 or 71 or 4 that you get back.  And what's the /s doing?

Because I had a headache and was not reading  or thinking very well. I
know, that's no bloody excuse :)

I should have left it alone after telling him about the $/ variable.

It should have read:

Supposing you have the whole file in $file_contents

my @chunks = split(/\n\n/, $file_contents);

Of course this would be better in no way that using $/ to split on
multiple empty lines.

The s was because I misread its explanation in the man pages.

Good thing I am going on a holiday for a month, starting monday. I am
getting too nonchalant.

:)

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | In the fight between you and the world,
Commercial Dynamics Pty. Ltd.       | back the world - Franz Kafka
NSW, Australia                      | 


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

Date: 26 Feb 1998 19:43:22 GMT
From: billy@cast.msstate.edu (Billy Chambless)
Subject: Re: The Ineffable Tom C.
Message-Id: <6d4gkq$bcn$1@nntp.msstate.edu>

In article <34f5b980.6571359@news.clara.net>, wrdcom@clara.net (Sean Ahern) writes:
|> On 25 Feb 1998 21:28:44 GMT, billy@cast.msstate.edu (Billy Chambless)
|> wrote:

|> >I wonder why you didn't have a similar witty comeback for the passge you
|> >quoted below -- the one that makes your original reference to _Learning
|> >Perl_ seem a bit silly.

|> >|>  In this case, the footnote reads:
|> >|> >"(*) Of course, some questions are too silly to answer, especially
|> >|> >those already answered in the FAQ."

|> 	Because the point was, since it appears to have escaped you,
|> that this newsgroup is referred to, at least once, in the 'standard'
|> beginner's book, as a source of assistance.  So why are you so bloody
|> surprised when it happens?

I'm not. It's entirely appropriate that people should come to this
newsgroup for help. That doesn't mean that they should use it as a
substitute for reading basic documentation.

|> You never asked a question that had been  asked before?   

Feel free to do a Deja News search to see if I've ever posted a question
here that was directly answered in the Perl FAQ.

|> 	 And whilst it does say 'some questions are too silly to
|> answer' it does not say 'some questions will get you slagged off by
|> people who have nothing better to do than decide their validity, and
|> judge your intellect accordingly'.

Yes, how careless of Randal to mention this newsgroup, and then fail to
explain Usenet culture and conventions. The lazy sot should have at
least included the Emily Postnews article in the book.

I shall criticise him in no uncertain terms at my earliest possible
convenience. But I will temper my criticism by offering him the
following text to be included in the next version of the book:

  "If you're posting a question to comp.lang.perl.misc, you probably
  ought to make sure it's not answed in this book or in the Perl FAQ,
  otherwise people might (correctly) assume that you are a lazy
  doody-head and make fun of you, leading to long whining contests."

Of course, Randal (and Tom) might try to say that the statement above
about "too silly to ask" implies that you should read before posting,
but....

|> If you think a question is too dumb to answer, don't answer.

A question that is too dumb to answer usually indicates a deep failure
to understand something, somewhere; pointing the person to basic resources is 
MUCH more helpful in the long run than spoonfeeding answers to them. 

-- 
* "And there _is_ a real world. In fact, some of you
*    are in it right now."  -- Gene Spafford


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

Date: 26 Feb 1998 20:09:31 GMT
From: kherron@campus.mci.net (Kenneth Herron)
Subject: Re: The Ineffable Tom C.
Message-Id: <6d4i5r$8r3$1@news.campus.mci.net>

In article <slrn6fadk2.v6e.Tom.Grydeland@mitra.phys.uit.no>,
Tom Grydeland <Tom.Grydeland@phys.uit.no> wrote:
|On 26 Feb 1998 02:41:14 GMT,
|Kenneth Herron <kherron@campus.mci.net> wrote:
|> each()-like capability that only returned keys.  It seems that each()
|> in a scalar context does this and has since 5.003 at least, but it
|> wasn't *documented* until 5.004 (and this hypothetical later printing
|> of the camel book; one of the RTFM'ers said it's in his copy),
|
|It's in my copy; last line on p. 159.

That's where the other guy said it was too, part of the chapter 3
description of each().  With my copy, the description of each() does
indeed span pp. 159-160,, but there's no mention of its behavior in a
scalar context.  Generally, my copy appears to be based on the 5.003 or
earlier docs, while your is probably based on 5.004.
-- 
Kenneth Herron -- kherron@campus.mci.net
"When Microsoft first took control of the Funk & Wagnalls Encyclopedia
product, there was a flattering biography of Bill Gates.  But it said he
was known as a tough competitor.  Now it says that he's known for his
charitable contributions." -- Gary Reback, <http://www.ljx.com/reback/>


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

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

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