[9730] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3324 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 3 10:05:39 1998

Date: Mon, 3 Aug 98 07:00:31 -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, 3 Aug 1998     Volume: 8 Number: 3324

Today's topics:
        $form_data question bfredett@my-dejanews.com
        $form_data{'$variable'} question bfredett@my-dejanews.com
        ANNOUNCE: Free Perl Books for 5.005 <tchrist@mox.perl.com>
    Re: cannot alias $_ in perl 5.005 <tchrist@mox.perl.com>
    Re: cgi grep <alan@find-it.furryferret.uk.com>
    Re: comp.lang.perl.announce redux (Mark-Jason Dominus)
    Re: comp.lang.perl.announce redux (Gabor)
    Re: comp.lang.perl.announce redux <tchrist@mox.perl.com>
    Re: connect CGI with MS-Access <perlguy@inlink.com>
    Re: connect CGI with MS-Access d.jehanno@tc-multimedia.com
        Form Data Question brian_fredette@vnet.ibm.com
    Re: Form Data Question <fauvelle@hotmail.net>
    Re: Good Book? <jdporter@min.net>
    Re: Has anyone used the POP3 module ? <alan@find-it.furryferret.uk.com>
    Re: Has anyone used the POP3 module ? <snif@xs4all.nonono.nl>
        help with string problem <Brettl@datent.com>
    Re: hiding user input <jdporter@min.net>
    Re: hiding user input <jdporter@min.net>
    Re: hiding user input <jdporter@min.net>
    Re: hiding user input <jdporter@min.net>
    Re: Interesting Question needs Quick Answer (I.J. Garlick)
    Re: Interesting Question needs Quick Answer (I.J. Garlick)
    Re: Interesting Question needs Quick Answer <quednauf@nortel.co.uk>
    Re: Interesting Question needs Quick Answer <jdporter@min.net>
    Re: Linux <sachse@aeb.de>
    Re: Newbie questions...help! <alan@find-it.furryferret.uk.com>
    Re: Newbie: Perl and Oracle?!? <quednauf@nortel.co.uk>
        op/rand test problem on SunOS 5.5.1 <sbaxter@c031.aone.net.au>
        pb with dbm file <coueron.ccas.info@dial.oleane.com>
        Problem opening pipe on SunOS 4.1.4 <mmclinn@draper.com>
        QUE: sgmlspm: Choosing the order of the HTML output <mike@tech.eurodyn.com.gr>
        regex question <dennis@bilbo.iok.net>
    Re: seeing if a file exists. <alan@find-it.furryferret.uk.com>
        Suggestion: file handle associated $\ (Bart Lateur)
    Re: Where to get a Perl/Tk for Windows? <alan@find-it.furryferret.uk.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Mon, 03 Aug 1998 13:15:01 GMT
From: bfredett@my-dejanews.com
Subject: $form_data question
Message-Id: <6q4d4l$t85$1@nnrp1.dejanews.com>

Greetings.

I have a form with several text fields.  These fields are named
editcol1,editcol2,editcol3 ... and so on.

I want to check if these fields are blank, if they are not then the value of
$new_data will equal the value of $form_data{'editcoln'} ... where n is the
number 1,2,3...

I am trying to set this up in a loop such as:

for($i=1,$i<=$total,$i++) {      # $total is set earlier
     $new_data = $form_data{'editcol$i'};
}                             /|\
                               |
                               |
Most likely the trouble is  ---|   I can't get the $i to
work inside the $form_data.

Any suggestions?

Thanks,
Brian

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


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

Date: Mon, 03 Aug 1998 13:15:02 GMT
From: bfredett@my-dejanews.com
Subject: $form_data{'$variable'} question
Message-Id: <6q4d4n$t9e$1@nnrp1.dejanews.com>

Greetings.

I have a form with several text fields.  These fields are named
editcol1,editcol2,editcol3 ... and so on.

I want to check if these fields are blank, if they are not then the value of
$new_data will equal the value of $form_data{'editcoln'} ... where n is the
number 1,2,3...

I am trying to set this up in a loop such as:

for($i=1,$i<=$total,$i++) {      # $total is set earlier
     $new_data = $form_data{'editcol$i'};
}                             /|\
                               |
                               |
Most likely the trouble is  ---|   I can't get the $i to
work inside the $form_data.

Any suggestions?

Thanks,
Brian

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


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

Date: 3 Aug 1998 12:55:56 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: ANNOUNCE: Free Perl Books for 5.005
Message-Id: <6q4c0s$h31$1@csnews.cs.colorado.edu>

I am pleased to announce the long-awaited release (last update: 15 months
ago) of the complete documentation, updated for the the 5.005 release
of Perl.   The postscript version is designed to be printed and bound
as a complete book, preferably on a double-sided printer considering
the length.  The text version is designed to be searched from within a
pager, such as less.

Here are the relevant URLs:

    Complete Perl Documentation (1256 pages as postscript)
	http://language.perl.com/info/PerlDoc-5.005_02.ps.gz         (1,774k)
    Table of Contexts (65 pages as postscript, roman page numbers)
	http://language.perl.com/info/PerlTOC-5.005_02.ps.gz            (52k)
    Table of Contexts, two-up (33 pages as postscript)
	http://language.perl.com/info/PerlTOC-2up-5.005_02.ps.gz        (56k)

    Complete Perl Documentation (1682 pages as text)
	http://language.perl.com/info/PerlDoc-5.005_02.txt.gz          (941k)
    Table of Contexts (66 pages as text)
	http://language.perl.com/info/PerlTOC-5.005_02.txt.gz           (31k)

These should make their way to their normal CPAN homes over the next
three days, but I thought you'd like to know about them now.

Enjoy.

--tom
-- 
    X-Windows: Sometimes you fill a vacuum and it still sucks.
	--Jamie Zawinski


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

Date: 3 Aug 1998 10:43:34 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: cannot alias $_ in perl 5.005
Message-Id: <6q448m$cv1$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, Matthew White <mwhite@csu.edu.au> writes:
:for instance, on 5.004 this worked as (*I*) expected:
:   perl -e '$b = "z\n"; *_ = \$b; print;'
:ie, it printed "\z".  but on perl 5.005 it prints nothing. What is
:going on here?

I can't reproduce this under 5.005_02 on my system.

--tom
-- 
    [End of diatribe.  We now return you to your regularly scheduled
    programming...]
        --Larry Wall in Configure from the perl distribution


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

Date: Mon, 3 Aug 1998 12:23:58 +0100
From: Alan Silver <alan@find-it.furryferret.uk.com>
Subject: Re: cgi grep
Message-Id: <CDwZ$PAO3Zx1EwVC@find-it.uk.com>

In article <35C204E3.696B744B@aisvt.bfg.com>, Finn Calabro
<fcalabro@aisvt.bfg.com> writes
>I trying to use a pipeline of greps in a cgi script for a database
>search with boolean 'AND'.  I've gotten close with things like:
>      foreach $item (@valuelist) {
>       $cmd = $cmd . "$grep -i $item $filename | ";
>      }
>      $ans = `$cmd`;
>but it won't run properly.  any feeback is appreciated.
>

I suspect that you only want $filename on the very first grep. If you
are piping the output of that into another grep, then you don't want to
give a file name for the second (and subsequent) greps.

The number of times I've done this myself ...

Plus, as another poster pointed out, you have to check that the last
grep does not pipe its output, otherwise you might not get it. i suspect
that the following code is closer to what you want ...

foreach $item (@valuelist) {
  if ($cmd eq "") {
    $cmd = "$grep -i $item $filename";
  } else {
    $cmd = "$cmd | $grep -i $item";
  }
}
$ans = `$cmd`;

Hope this helps.

-- 
Alan Silver
Please remove the furryferret when replying by e-mail


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

Date: 3 Aug 1998 08:21:45 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: comp.lang.perl.announce redux
Message-Id: <6q4a0p$3ef$1@monet.op.net>


In article <6q3a1a$7ih$6@client3.news.psi.net>,
Abigail <abigail@fnx.com> wrote:
>++     7) Articles must be in English, and have a reply-able email address.
>
>Do we really need a language restriction, and if so, why English?

I was surprised by this also.  I realize it might be inconvenient for
Randal to have submitted articles translated to a language he
understands, but in some cases it might be possible; if not he can
reject the article.  Either way, I don't understand why it is
necessary to state in advance that all such articles will be
rejected.   


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

Date: 3 Aug 1998 12:32:34 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: comp.lang.perl.announce redux
Message-Id: <slrn6sbbj5.lsi.gabor@guava.vmunix.com>

In comp.lang.perl.misc, Randal Schwartz <merlyn@stonehenge.com> wrote :
# OK, here's my next cut at the updated charter.
# 
#     comp.lang.perl.announce is a low-volume announcement group for messages
#     that benefit the worldwide Perl programming community.  The acceptance
#     criteria are as follows:
# 
#     3) Your post must be completely non-commercial, *unless* you have the
#        sponsorship of a recognized non-profit organization (like Perl
#        Mongers, The Perl Institute, or Usenix/LISA).  Commercial posts
#        will be tagged in the subject line as [COM].

This will be very difficult to enforce.  How will you determine such
sponsorship?

#     4) Perl code *must* reside in the CPAN.  Non-CPAN code announcements
#        will be rejected, even if sponsored as a commercial post.  (See
#        http://www.perl.com/CPAN/modules/04pause.html for details on how to
#        submit items to the CPAN.)  Postings consisting of source code will
#        be rejected. (If it's good enough to post, it's good enough to go
#        into the CPAN.)

What if one were to have a new module and wanted some people to look at
it and test it before putting it on the CPAN?  Sounds like a valid
announcement to me.

#     7) Articles must be in English, and have a reply-able email address.

I heartily agree.  Seeing non-English posts is annoying.  And before
people flame me, my mother tongue isn't English.


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

Date: 3 Aug 1998 10:06:57 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: comp.lang.perl.announce redux
Message-Id: <6q4241$bjv$1@csnews.cs.colorado.edu>

In comp.lang.perl.misc, birgitt@my-dejanews.com writes:
:Is that your assumption that the current moderator can read
:just the English and the Perl language (sounds very sufficient to me)
:or do you know that for a fact ?

Oh, it's true.  The current moderator is just another hopelessly
monolingual American.  This is easily remedied. :-)

--tom
-- 
    I won't mention any names, because I don't want to get sun4's into
    trouble...  :-)     --Larry Wall in <11333@jpl-devvax.JPL.NASA.GOV>


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

Date: Mon, 3 Aug 1998 11:39:13 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: connect CGI with MS-Access
Message-Id: <35C5A161.C838590E@inlink.com>

If you are on an NT server, go to http://www.roth.net/odbc

If you are on a UNIX server, port it to a different database and then go
to http://www.perl.com and click on databases.

Hell, go to http://www.perl.com anyway!

HTH,

Brent


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

Date: Mon, 03 Aug 1998 12:07:57 GMT
From: d.jehanno@tc-multimedia.com
Subject: Re: connect CGI with MS-Access
Message-Id: <6q496t$p1v$1@nnrp1.dejanews.com>

In article <6q3uc6$4fj$1@sun579.rz.ruhr-uni-bochum.de>,
  "Alexander Marquart" <info@kptkip.com> wrote:
> Hello there!
>
> I4ve got the problem to connect our Web-Server via CGI to the data on our
> Access- Server.
>
> Does anybody know if it is possible to get the data out of the database with
> CGI to implement these in my HTML-pages?
>
> For any hint, how to realize this or for any information, where to get
> further details to solve this problem i would be very kind.
>
> Thanks a lot and cu here soon!
>
> Alex
>
>
Hi,
If you want to use your database, you can use ODBC and perl:
to have perl you can dowloaded it on
http://activestate.com
I have
ODBC+Perl and i use datas whith Foxpro and informix.
Didier.

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


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

Date: Mon, 03 Aug 1998 13:21:55 GMT
From: brian_fredette@vnet.ibm.com
Subject: Form Data Question
Message-Id: <6q4dhj$u03$1@nnrp1.dejanews.com>

Greetings.

I have a form with several text fields.  These fields are named
editcol1,editcol2,editcol3 ... and so on.

I want to check if these fields are blank, if they are not then the value of
$new_data will equal the value of $form_data{'editcoln'} ... where n is the
number 1,2,3...

I am trying to set this up in a loop such as:

for($i=1,$i<=$total,$i++) {      # $total is set earlier
     $new_data = $form_data{'editcol$i'};
}                             /|\
                               |
                               |
Most likely the trouble is  ---|   I can't get the $i to
work inside the $form_data.

Any suggestions?

Thanks,
Brian

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


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

Date: Mon, 03 Aug 1998 15:58:48 +0200
From: Jean-Philippe FAUVELLE <fauvelle@hotmail.net>
To: brian_fredette@vnet.ibm.com
Subject: Re: Form Data Question
Message-Id: <35C5C218.3C9209AC@hotmail.net>

brian_fredette@vnet.ibm.com wrote:I am trying to set this up in a loop such as:

>
>
>
> for($i=1,$i<=$total,$i++) {      # $total is set earlier
>      $new_data = $form_data{'editcol$i'};
> }                             /|\
> Most likely the trouble is  ---|   I can't get the $i to
> work inside the $form_data.

well... this sounds like a neebie question... ;-)

There is a difference bettween 'xxx' and "xxx".
Perl does not evaluate a string single quoted.
consider the following:

$foo = 'World'; # in this case, "World" would work too.
$wrong = 'Hello $foo';  # --> 'Hello $foo' (constant)
$good = "Hello $foo"; # --> 'Hello World' (interpolation)
$good = "Hello ${foo}"; # same above
$good = 'Hello ' . $foo # same above
$good = sprintf( 'Hello %s', $foo );

You will encounter exactly the same problem with end of lines...
"\n" is a carriage return (one single char). '\n' is a string (two chars).

A 'constant' string need no computation, so
$a = 'Hello world"
is faster than
$a = "Hello wolrd"
even if no interpolation was needed this time.

See the perl documentation for more on this.

Hop that helps !

______________________________________
Jean-Philippe FAUVELLE  <gandalf@fth.net>




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

Date: Mon, 03 Aug 1998 13:12:31 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Good Book?
Message-Id: <35C5B7C6.643B@min.net>

Tom Christiansen wrote:
> 
> jdporter@min.net writes:
> :The Camel Critiques page is indispensible for deciding
> :what books to use.
> :
> :But it is of little help it determining whether a book
> :is useful, which does not appear in its list.
> 
> Just keep at 4 and 5 camels and be fine?

This still doesn't help me know if a book I already own
is worth using.  Am I to infer that if it isn't a 4/5 camel
book in Camel Critiques, it is not a good book?  What,
all the 4/5 camel books have already been reviewed, and
all else is chaff?

-- 
John Porter


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

Date: Mon, 3 Aug 1998 12:59:18 +0100
From: Alan Silver <alan@find-it.furryferret.uk.com>
Subject: Re: Has anyone used the POP3 module ?
Message-Id: <pAGjfeAWYax1EwBp@find-it.uk.com>

In article <6ps2mu$75m$1@news.gns.getronics.nl>, Jonkers
<snif@xs4all.nonono.nl> writes
>>As I do not have access to a POP3 mail server, I am unable to test out
>>such a script. Does anyone there know how to do it and have a POP3
>>server that they could test it on for me ? Thanx very much for any help.
>
>If you don't have access to a POP3 mail server, it is probably very
>difficult to write the script because 'write' often means
>'write-run-debug-write-run-debug ...'. If this is not true for you, you can
>just write your script from the Perl and POP3 documentation.

I know it's difficult. That's why I asked if anyone would be able to
help.

>Much easier way: get an account (including POP3) at an ISP or install some
>POP3-server (not client) on your own system. This makes writing-testing
>cycles much easier.

Not so easy. I have a POP3 mailbox with an ISP, but am not sure how to
access it from Perl. Would I just need to connect to the internet and
then use the POP3 module commands as though it was a local server ?

-- 
Alan Silver
Please remove the furryferret when replying by e-mail


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

Date: Mon, 3 Aug 1998 14:42:19 +0200
From: "Jonkers" <snif@xs4all.nonono.nl>
Subject: Re: Has anyone used the POP3 module ?
Message-Id: <6q4b5p$kuq$1@news.gns.getronics.nl>


Alan Silver wrote in message ...

<snip>

>
>Not so easy. I have a POP3 mailbox with an ISP, but am not sure how to
>access it from Perl. Would I just need to connect to the internet and
>then use the POP3 module commands as though it was a local server ?

Here's sample script that works OK for me (with Dutch words):

$pop3host = "pop.myISP.com" ;
$login = "myname" ;
$password = "mypass" ;


use Net::POP3;

$pop = Net::POP3->new($pop3host);

$number = $pop->login( $login , $password );

@status = $pop->popstat();

$number = $status[0] ;

print "aantal berichten is $number\n";

for( $i=1; $i<=$number ; $i++ ){
 $m = $pop->get($i);
 print @$m if $m;
}

$pop->quit;

print "klaar\n";






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

Date: Mon, 3 Aug 1998 13:52:17 +0100
From: "Brett Lawrence" <Brettl@datent.com>
Subject: help with string problem
Message-Id: <902148658.2439.0.nnrp-04.c3ad0896@news.demon.co.uk>

Hi
I have a dir with the file below in it
v|dih`V\D.TXT

When I readdir() and print the result to the screen I get
 .
 ..
v|dih`V\D.TXT

But when I write it to a file with print and then open it in notepad or
pfe I get
 .
 ..
Rubbish.TXT     where rubbish is a unreadable windows character

I need it to display the correct file name in the file.

below are a few examples

dec     oct      hex      char    but also dec
148     0224    0x94    v          246
129     0201    0x81    |          252
132     0204    0x84    d          228
130     0202    0x82    i          233
138     0212    0x8a    h          232
133     0205    0x85    `          224
153     0231    0x99    V          214
154     0232    0x9a    \          220
142     0216    0x8e    D          196

Is there away to force perl not to use the value between 128-159 in the
ascii table but to use the high end equivalent?
This I think would solve my problem.

thanks for an help
Brett




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

Date: Mon, 03 Aug 1998 13:35:17 GMT
From: John Porter <jdporter@min.net>
Subject: Re: hiding user input
Message-Id: <35C5BD1C.6F86@min.net>

Gary L. Burnore wrote:
> 
> Ronald J Kimball wrote:
> >There are three reasons why using a kill-file is not an optimanl
> >solution in this case.
> >
> >1) The existence of kill-files does not justify off-topic posts.
> 
> The post isn't off topic if it's in re: users abusing others asking questions
> in _THIS_ newsgroup.
> 
> >2) Kill-filing on participants may delete other, useful posts from the
> >participants.  Kill-filing on the thread may delete other, useful posts
> >on the original topic.
> 
> True.
> 
> >3) Even using kill-files, the newsreader must still download at least
> >the headers of every message in the newsgroup.
> 
> True.

Interesting that you chose to agree unconditionally with rjk's two
weaker points.  Indeed, point #1 is unarguable true.
Off-topic is off-topic, even for meta-discussions such as this one.
It doesn't matter how irritated some other posters make you;
you have to control your itchy post finger.
Let "Abigail"s posts speak for themselves to posterity; you don't
need to add any off-topic ranting to make sure our children
(or their employers) get the point.

-- 
John Porter


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

Date: Mon, 03 Aug 1998 13:46:03 GMT
From: John Porter <jdporter@min.net>
Subject: Re: hiding user input
Message-Id: <35C5BFA2.6330@min.net>

Gary L. Burnore wrote:
> 
> It's not proper USENEt etiquette to email someone over a
> USENet post without it being requested.  

Actually you're mistaken about that.
It is entirely proper to take personal discussions, and
discussions which are not on-topic for any known newsgroup,
to email.  It is analogous to taking a dicussion to a private
chat room from a public one, on systems like AOL.


> There's a brand-spanking-new moderated
> group created just for such people.
> Abagail and Bacon and those who support
> their kind of posts should simply post there 

No, that's not what clp.moderated was created for.
That newsgroup will never see such posts, because FAQs will
never be asked there.


> I followed up to abigail because I'm NOT a new user to the
> internet or to USENet and I'm NOT going to take any shit from anyone.

I don't see how you have much of a choice.
You can rant, if you choose, or not; you would be foolish to
think that "Abigail"s behavior will change as a result.
In effect, you're wasting your breath.

-- 
John Porter


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

Date: Mon, 03 Aug 1998 13:47:19 GMT
From: John Porter <jdporter@min.net>
Subject: Re: hiding user input
Message-Id: <35C5BFEE.1440@min.net>

Gary L. Burnore wrote:
> 
> gbacon@cs.uah.edu (Greg Bacon) wrote:
> >The whole reason people compose FAQ lists is because they're tired of
> >seeing the same questions over and over and over and over and over and
> >over and over and over and over and over and over and over and over and
> 
> So if you're tired of answering over and over ..., stfu and go away.

But he didn't say he was tired of answering, he said he was tired of
seeing the questions.  Not the same.

-- 
John Porter


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

Date: Mon, 03 Aug 1998 13:55:21 GMT
From: John Porter <jdporter@min.net>
Subject: Re: hiding user input
Message-Id: <35C5C1D0.36D6@min.net>

Gary L. Burnore wrote:
> 
> I'll be sure to Call both Stanford and Dartmouth on Monday and let the admins
> there know exactly what I think of your actions.

If any of those admins have half a clue, they'll check the clpm
archives,
and will become quite clear to them that you are the one with the
problem.
And there are plenty of us who will be glad to field emails or phone
calls to affirm the same.

-- 
John Porter


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

Date: Mon, 3 Aug 1998 08:11:40 GMT
From: ijg@csc.liv.ac.uk (I.J. Garlick)
Subject: Re: Interesting Question needs Quick Answer
Message-Id: <Ex3tFG.5vL@csc.liv.ac.uk>

In article <35c58544.69962873@news.oz.net>,
tgy@chocobo.org (Tim Gim Yee) writes:
> On Fri, 31 Jul 1998 17:38:18 GMT, ijg@csc.liv.ac.uk (I.J. Garlick)
> wrote:
> 
>>In article <6pqd5c$c3l5@mascagni.pfizer.com>,
>>jack_h_ostroff@groton.pfizer.com (Jack Ostroff) writes:
>>> It took a while, but I have a solution in 26 lines, including
>>> -w and use strict.  My biggest problem was quoting quotes.
>>> 
>>> I'll be glad to post it - but not until someone can assure me that
>>> it is too late for someone to use it as a homework solution.
>>> 
>>> For those who didn't quite understand the wording of the problem:
>>> 'cat self.pl' and 'perl self.pl' should produce identical output
>>> or 'perl self.pl | diff self.pl -' should produce no output.
>>
>>It's Ok he has been shown the solution now.
>>
>>However do feel free to post yours as it took 49 lines here.
> 
> perl -we 'seek DATA, 0, 0 and print <DATA> __DATA__'
                                      ^^^^^^
I may be being a bit picky here but doesn't the above thing mean you are
reading something in? which was deffinately a no no. Besides we did come
up with that (or something very similar) within 5 to 10 minutes of the
problem being set. It was immediately discarded for the reasons I have just
pointed out.

--
Ian J. Garlick
ijg@csc.liv.ac.uk

Your conscience never stops you from doing anything.  It just stops you
from enjoying it.


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

Date: Mon, 3 Aug 1998 08:33:55 GMT
From: ijg@csc.liv.ac.uk (I.J. Garlick)
Subject: Re: Interesting Question needs Quick Answer
Message-Id: <Ex3uGK.71w@csc.liv.ac.uk>

In article <m3af5oclkm.fsf@windlord.stanford.edu>,
Russ Allbery <rra@stanford.edu> writes:
> P L Hegarty <sm8plh@csc.liv.ac.uk> writes:
> 
>> I want to write a perl script which produces as its output an exact copy
>> of itself. So when you run the script you get exactly the same output to
>> screen as if you used 'cat' or 'type'. You can not read anything into
>> the script or use any system calls. That last bit is the heart of the
>> problem.
> 
> See my sig.
> 


--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print

Great Russ.

Now could you explain it? (I have only been learning Perl since April and
Patrick started last Tuesday)

I got as far as

	@!>~|

I think I have got the meanings of each of these (from the camel) but when I
try to work out what they are all doing together I get lost.

I am not really that sure what the $^=q does apart from some formatting
thingy that I was hoping would become self explanetory in this context once
I worked out what the rest does. However I admit defeat.

--
Ian J. Garlick
ijg@csc.liv.ac.uk

Still a Perl newbie. :-)
Your conscience never stops you from doing anything.  It just stops you
from enjoying it.


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

Date: Mon, 03 Aug 1998 13:21:30 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Interesting Question needs Quick Answer
Message-Id: <35C5AB4A.DDA82A23@nortel.co.uk>

Russ Allbery wrote:
> See my sig.

#!/usr/bin/perl
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD
gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.),
01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/
#y,d,s,(\$.),$1,gee,print

Gives the following output:

#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD
gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.),
01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/
#y,d,s,(\$.),$1,gee,print

Now, that's not the same, is it ? :) But then I changed the program...Oh
I don't know, just an observation. Mr Garlick had trouble understanding
this, same me...


-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: Mon, 03 Aug 1998 13:06:52 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Interesting Question needs Quick Answer
Message-Id: <35C5B673.1F02@min.net>

Mark-Jason Dominus wrote:
> 
> In article <6pt8ob$ish@news-central.tiac.net>,
> Mike Stok <mike@stok.co.uk> wrote:
> >26 lines?
> >
> >#!/usr/local/bin/perl -w
> >use strict;
> >seek DATA, 0, 0;
> >print while <DATA>;
> >__END__
> 
> The original problem specification prohibited `system call's, and I
> suspect that this was expressly to prevent solutions liked yours that
> explictly read the program's source file.

I may be wrong, but I thought by "system calls" they meant calls to
the perl built-in named "system", not calls to "syscall", or other
things which trap to the kernel.

-- 
John Porter


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

Date: Mon, 03 Aug 1998 13:31:49 +0200
From: "L|der Sachse" <sachse@aeb.de>
Subject: Re: Linux
Message-Id: <35C59FA4.E30EEB4D@aeb.de>

It depends on what you want to do. If you just want to run a web server or
do some programming a 386 with 8MB should do fine. If you want to run X it
should be a 486 with 16 or 32MB although even that works with a 386. Just
give it a try. The hardware requirements are much lower than for Windoze.

Lueder

Dave Mckeown schrieb:

> It seems like alot of people in here are into unix, I have a question.
> What is the bare minumum system requirements to run linux, redhat to be
> exact at a comfortable speed?
>
> --
> Icq# 14056739
> mailto:dmckeown@istar.ca





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

Date: Mon, 3 Aug 1998 12:57:27 +0100
From: Alan Silver <alan@find-it.furryferret.uk.com>
Subject: Re: Newbie questions...help!
Message-Id: <mQ6gbZAnWax1EwAT@find-it.uk.com>

In article <35C5BF0C.1832C56F@ix.netcom.com>, Ricardo Astudillo
<astudill@ix.netcom.com> writes
>Hello,
>
>I'm probably looking in the wrong places, but I need to know what
>exactly the following things mean;

you're looking in the right place.

>2) Somebody tell me exactly what this does:
>($line = <FILE>);

This copies the contents of the file whose handle is FILE (ie there
should be an open(FILE,"ferret.txt"); statement somewhere above it) into
the variable $line. If you used

@line = <FILE>;

then it would do the same thing, but put each line (in ASCII terms) of
the file into an element in the array (as opposed to sticking them all
together like the previous example).

By the way, I don't think the brackets around your example are needed.
As far as I know, $line = <FILE>; would work the same.

>and while you're at it,
>$line =~ s/[\r\n]//g;

the =~ operator modifies the string on the left side according to the
rule on the right side. In this case, the rule on the righ side is a
substitution one, shown by the fact that it starts with an 's'. The /
signs are delimeters and there should be three of them. The 's' before
the first means "substitute" and Perl will examine the stuff between the
first and second / to see if it can match. If it matches, it substitutes
the stuff between the second and third / in place. The 'g' at the end
means "global", ie do this as many times as you can in the string, not
just for the first time.

An example ...

$ferret = "hello world";
$ferret =~ s/world/ferrets/g;

would leave $ferret containing "hello ferrets". Perl matched "world"
(between the first and second /) and substituted "ferrets" (which it
found between the second and third /s) in its place.

Your example uses two extra features of regular expressions. The square
brackets match any single character out of the ones inside. Thus [abc]
would match 'a' or 'b' or 'c'. In your case, the charace=ters inside are
control characters - \n means new line and \r means carriage return. As
you have just read a (presumably ASCII) file into a scalar variable, you
evidently want to remove all new lines a c/r characters so that the
whole file can be processed in one go. The s/[\r\n]//g does this for
you. perl matches any \r or \n characeters that it finds and then
substitutes nothing for them (as there is nothing between the second and
third /s). The 'g' means "do this for every possible match in the
string".

I hope this helps. Regular expressions are a tricky subject and require
a lot of playing. Have a good read of the Perl documentation. You should
also read "Learning Perl" which explains this stuff well. There is also
an extensive FAQ which is posted here very regularly and covers regexps.

>
>I would really appreciate it if you e-mailed me.
>astudill@ix.netcom.com

Ah but that would be *really* anti-sociable and totally not what Usenet
is all about. This is a public discussion and should be kept that way.
Suppose I told you a pile of junk above, you would never know if I e-
mailed you. By posting here, other people can see my answer and comment
(if necessary). Also, other people might find the answer helpful.

please don't ask for private e-mails. If you want help (which is a Good
Thing), please be reasonable and ask for it via the newsgroup.

Not a flame, just a gentle piece of advice to someone who may not know
Usenet ettiquette too well.

-- 
Alan Silver
Please remove the furryferret when replying by e-mail


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

Date: Mon, 03 Aug 1998 11:59:31 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Newbie: Perl and Oracle?!?
Message-Id: <35C59813.961AFF8A@nortel.co.uk>

Chi Letton wrote:
> 
> Hello all
> 
> I am very new to this Perl stuff so please be patient.
> 
> I need to get Perl to access Oracle tables.  I will need to read and
> write.  Is there an easy way to do this? (I hope so!)


Your friendly local CPAN dealer will help you here. You find the
addresses to that chain of excellent candy stores under e.g.
www.perl.com . In CPAN look for a thing called Oraperl. 


-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: Mon, 3 Aug 1998 23:08:42 +1000
From: "Scott A Baxter" <sbaxter@c031.aone.net.au>
Subject: op/rand test problem on SunOS 5.5.1
Message-Id: <6q4cvn$i3c$1@news.mel.aone.net.au>

I am trying to install perl 5.003 on SunOS 5.5.1 and I find that when I run
the make test op/rand fails on test2.

When I ran Configure the script said that the number of bits returned by my
rand function was 31. I accepted the default and I suspect that this may be
the problem. I am not sure what value I should use.

Any advice would be much appreciated.







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

Date: Mon, 03 Aug 1998 15:38:41 +0200
From: mj058-1 <coueron.ccas.info@dial.oleane.com>
Subject: pb with dbm file
Message-Id: <35C5BD61.D4EB0EA4@dial.oleane.com>


Hi!
 I'm in trouble with dbm file...I want to save an assoc array (%offres)
in a dbm file(%bd).
 But, in the %offres table there are 103 items, and in the %bd array
there are only 78...
 why?
 This is the code i use to create the dbm file :

>  dbmopen(%bd,"bd_oe","0666");
>  for(; ($clef,$val)=each %offres;)
>   { $bd{$clef}=$val; }
>  dbmclose(%bd);
>
 I've counted the total of item of %offres in the loop, and the total is
correct (103).
 And when i execute this just after the creation :

 @tab = keys(%bd);
 print $#tab;

 Perl gives me "78" not 103....
 and when i do : print $#bd; perl gives me "-1"...
 Well...if you have any help, i'll be pleased:))
 Thx
 Frank


--
 ------------------------------------------------------------------
 Constitution Class: USS Enterprise NCC-1701 Refit/NCC-1701A
 ___________________          _-_
 \==============_=_/ ____.---'------.____          Jardillier Frank
             \_ \    \----._________.----/        =================
               \ \   /  /    -_-'    yannsulu@elya.unilim.fr
           __,--.-'..'-_                jardilli@irin.univ-nantes.fr
          /____          ||          jardilli@ensinfo.univ-nantes.fr
               --.____,-'          coueron.ccas.info@dial.oleane.com
 -------------------------------------------------------------------
 ------------------------ An AMIGA Survivor ------------------------




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

Date: 3 Aug 1998 13:38:44 GMT
From: Michael McLinn <mmclinn@draper.com>
Subject: Problem opening pipe on SunOS 4.1.4
Message-Id: <6q4eh4$qsm$1@camelot.ccs.neu.edu>

Hello, I'm trying to get a script to run in a multiplatform environment that
needs to open a fifo and write to it.  This works just fine on Solaris & DEC
OSF, but the script fails on SunOS 4.1.4.  I was able to generate some 
simplified code that generates the problem on sunos but not other systems.  
The simplified code is as follows:

#!/usr/local/bin/perl

unless ( -p "login_pipe" ) {
        unlink "login_pipe";
        system("mknod", "login_pipe", "p")
                && die "Can't mknod pipe: $!\n";
}
print "Running\n";
open PIPE, "> login_pipe" or die "Couldn't open: $!\n";
print PIPE "test\n";
close PIPE;

On Solaris & OSF this script works as expected, it blocks until something 
reads from the pipe, then it writes "test" to the pipe and exits.  

On SunOS 4.1.4, this gives the error "File exists.", it does the same if I try
to append to the file instead.

The only thing I can think of is it's a problem with perl on SunOS (unlikely),
or it's a problem with how my version is compiled.  I have had this problem 
with perl 5.004 & 5.005.  I didn't get any errors during make test.  

If anyone has any ideas, please email me at mmclinn@draper.com or post a reply
on here.  Thank you.


-Mike McLinn
-mmclinn@draper.com



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

Date: Fri, 31 Jul 1998 12:56:47 +0300
From: Mihalis Tsoukalos <mike@tech.eurodyn.com.gr>
Subject: QUE: sgmlspm: Choosing the order of the HTML output
Message-Id: <35C194DF.51FB059E@tech.eurodyn.com.gr>

Hi to everyone.
I am using sgmlspm-1_03ii [the one that creates a skeleton file] to
convert a SGML file to HTML and I want to know if it is possible for me
to determine the order of the TAGs in the html output file.
What I mean is that if in a given DTD I have first the DATE tag and then
the TIME tag, I want  in the output html file to have first the TIME and
then the DATE.
If not is there any other program that lets me do this.

many thanks in advance,
mihalis.

--
--------------------------------------
Name: Mihalis Tsoukalos
Software Engineer
mailto:mike@tech.eurodyn.com.gr
Home Email: mailto:diogenes@hol.gr




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

Date: Mon, 03 Aug 1998 11:59:11 GMT
From: Dennis Wetzig <dennis@bilbo.iok.net>
Subject: regex question
Message-Id: <35C5A5B3.DE3@bilbo.iok.net>

Hello, 

probably a dumb question...

Think of this situation:

$var='aaa';

Now $var=~s/a/b/g; would make $var=='bbb';

How can I make $var=='aba'; or said different: What 
does the regex have to look like to match only the 
2nd time the 'a' occurs?

Thanks for all answers!

Dennis 

P.S.: Would be nice if you could mail me a copy of your answer!


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

Date: Mon, 3 Aug 1998 11:35:01 +0100
From: Alan Silver <alan@find-it.furryferret.uk.com>
Subject: Re: seeing if a file exists.
Message-Id: <9zGWTKAVJZx1EwQC@find-it.uk.com>

In article <6q2tem$l1$1@nswpull.telstra.net>, Martien Verbruggen
<mgjv@comdyn.com.au> writes
>In article <bbkCJQAFnYw1EwP9@find-it.uk.com>,
>       Alan Silver <alan@find-it.furryferret.uk.com> writes:
>
>> More importantly, REMOTE_ADDR is set by the *browser*, not the server.
>
>Offtopic, but.. Are you absolutely certain about this?

Evidently not judging by the other answers to my comment !! Looks like I
was misinformed and Usenet strikes one more blow to the fatally crippled
(but kept alive by Microsoft) "I'm sure about this even though it's
wrong" lobby.

-- 
Alan Silver
Please remove the furryferret when replying by e-mail


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

Date: Mon, 03 Aug 1998 11:40:35 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Suggestion: file handle associated $\
Message-Id: <35c6a106.723801@news.tornado.be>

I use $\ a lot for output. Same for $,. However, when generating files
simultaniously for different platforms, the settings would have to be
different for each output file handle.

Would you people be interested if $\ would be associated with the
currently selected file handle? Just like now for $|. I guess it might
break existing code. Sigh. Maybe a module wrapper could deal with that.

It would, for example, be interesting to be able to have $\ set to "\n"
for the output file/STDOUT, and undefined for STDERR. Hmm. Personally, I
feel that $\ and $, are psychologically linked to the current output,
i.e. a different output channel implies a different association.

	Bart.


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

Date: Mon, 3 Aug 1998 12:43:32 +0100
From: Alan Silver <alan@find-it.furryferret.uk.com>
Subject: Re: Where to get a Perl/Tk for Windows?
Message-Id: <6g6nXVAkJax1Ewg$@find-it.uk.com>

In article <6q3qie$ip$1@news00.btx.dtag.de>, Volker Bohm <vboehm@t-
online.de> writes
>Where can I get a binary version of Perl _and_ Tk running on Windows 95
>and Windows NT?

Grab the perl5.00402-bindist04-bc (numbers may have changed by now) port
from CPAN. This is a pre-compiled version of Perl that includes a whole
load of the most useful modules including Tk. I am using this on Windows
NT and am very happy with it.

-- 
Alan Silver
Please remove the furryferret when replying by e-mail


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

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

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