[16910] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4322 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 14 11:07:09 2000

Date: Thu, 14 Sep 2000 08:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <968943910-v9-i4322@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 14 Sep 2000     Volume: 9 Number: 4322

Today's topics:
        "perl -ne" w/nonzero exit?; chging exit code w/END blk? (Tom Rodman)
        Arc/Info asciigrid sous Unix <poizot@intechmer.cnam.fr>
    Re: CGI.pm with explorer 5.0 (newbie question) <flavell@mail.cern.ch>
    Re: Character Class in Regex - Despecify What? (Mark-Jason Dominus)
        copying only non-open files <davemci@nortelnetworks.com>
    Re: File name with space in Net::FTP put <graham.wood@iona.com>
    Re: File name with space in Net::FTP put scarlzong@my-deja.com
        fileevent (tcl) under perl? <beier@itt.uni-stuttgart.de>
    Re: fileevent (tcl) under perl? (Gwyn Judd)
    Re: fileevent (tcl) under perl? <lusol@Pandora.CC.Lehigh.EDU>
    Re: Finding subdirectories on Windows Systems <thunderbear@bigfoot.com>
        How do I sort a list of list by a certain column <ubl@schaffhausen.de>
    Re: How do I sort a list of list by a certain column (Koos Pol)
    Re: How do I sort a list of list by a certain column (Abigail)
        Howto:  bidirectional and forking Socket Server <arolfes@dds.nl>
        Is there a good freeware/shareware IDE for PERL? <lkh@class.class.lviv.ua>
        Limitation when reading names in directory ? <paul.vandevelde@mcd.alcatel.be>
    Re: Limitation when reading names in directory ? (Mark-Jason Dominus)
        Perl patrick_k6801@my-deja.com
    Re: Perl (Gwyn Judd)
    Re: Perl <nickco3@yahoo.co.uk>
    Re: Perl <jeffp@crusoe.net>
    Re: Perl <bmb@ginger.libs.uga.edu>
        problem with csv cgi script <gpcu.mwagley@gcnet.com>
    Re: Problem with refresh (Abigail)
    Re: Problem with STDIN (newbie question) <unicon@btconnect.com>
    Re: Qualifications for new Perl programmer????? <godzilla@stomp.stomp.tokyo>
    Re: Qualifications for new Perl programmer????? (Andrew Johnson)
    Re: sprintf() rounding problem <davidhj@mail.com>
    Re: sprintf() rounding problem (Gwyn Judd)
    Re: Strange characters when using forms ^M <Cl0ud9@mail.tds.net>
    Re: Test Your Perl Skills (Smylers)
        tranferring a file on remote host (Paolo)
    Re: tranferring a file on remote host <graham.wood@iona.com>
        UNICODE & SSI <laoxiu100@hotmail.com>
        use of locale in win32 version of perl <adoupas@xanthi.ilsp.gr>
    Re: Working with IP addresses (hymie!)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 14 Sep 2000 13:38:23 GMT
From: trodman@nyx.nyx.net (Tom Rodman)
Subject: "perl -ne" w/nonzero exit?; chging exit code w/END blk??
Message-Id: <968937882.227470@iris.nyx.net>

Is it possible to change the exit code of a perl script 
by doing something within an "END" block?

How can I write a script using the "-n" syntax such that
the script *may* conditionally exit with nonzero exit
code?

This may hint at what I'm after:

perl -np -e '
 s/red/blue/;
 /green/ && do {$fail=1} ;
 END {if ($fail) { 
      0 or die "oops I would like to exit w/code 1 here\n";
                 }
     }' < myfile

How can the above be cleaned up to work?

Pls also send e-mail.

THANKS,

Tom Rodman
rodmant@pounder.sol.net



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

Date: Thu, 14 Sep 2000 16:50:19 +0200
From: Emmanuel POIZOT <poizot@intechmer.cnam.fr>
To: Sabine Brun <sbrun@esrifrance.fr>
Subject: Arc/Info asciigrid sous Unix
Message-Id: <39C0E5AB.C1401761@intechmer.cnam.fr>

Bonjour,
avez-vous des nouvelles pour le PB d'asciigrid sous Arc/Info Unix ?

--
Cordialement
_________________________________________________
Emmanuel POIZOT
CNAM/INTECHMER
B.P. 324
50103 CHERBOURG
Tél (direct) (33) 233 887 342
Fax  (33) 233 887 339
URL  http://www.intechmer.cnam.fr




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

Date: Thu, 14 Sep 2000 12:28:43 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: CGI.pm with explorer 5.0 (newbie question)
Message-Id: <Pine.GHP.4.21.0009141226350.6979-100000@hpplus03.cern.ch>

On Thu, 14 Sep 2000, Robert Delisle wrote:

> Someone  can explain why a sript using CGI.pm (2.76) work fine wiith
> netscape 4.70 , explorer 4.0(windows 95) and DON't work with explorer
> 5.0 (windows 98).

ETOOLITTLEINFO - I wouldn't even try explaining.   Nor do I perceive
a Perl language question.

If you want help, then post appropriate information to an appropriate
group.  I would expect that appropriate group to be
comp.infosystems.www.authoring.cgi in the first instance.




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

Date: Thu, 14 Sep 2000 14:45:08 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Character Class in Regex - Despecify What?
Message-Id: <39c0e473.296c$34a@news.op.net>

In article <8ppt8l$art$1@wanadoo.fr>,
Elisa Roselli <e.roselli@volusoft.com> wrote:
>Sean McAfee wrote:
>> $/ = "";
>
>Shouldn't it be $/ = "\n\n"; ?

That's very observant of you.  "\n\n" is quite similar, but reading
text in paragraphs is a very common operation, so Perl has a special
facility built into it just for that, which you enable by setting $/ =
"".  

$/ = "" is a special case.  It puts perl into 'paragraph mode', in
which *any* sequence of blank lines is considered to separate
sections; "\n\n" says that one single blank line separates sections.

The difference comes up if you have more than one blank line in
between paragraphs:

        blah blah blah blah blah blah blah blah blah blah blah blah 
        (blank line here)
        (blank line here)
        (blank line here)
        more more more more more more more more more more more more 

The middle part of this text actually contains the following
characters:

        ... blah blah\n\n\n\nmore more...

Suppose that $/ = "\n\n".  Perl will see the first \n\n and take that
to be the end of the first paragraph, which will contain "... blah
blah\n\n".  Then Perl will see the next \n\n and take that to be the
end of the second paragraph, which contains just "\n\n" and nothing
else.  Then the third paragraph will "more more ..." to the end.
There are three paragraphs here, and the middle one is blank.

But it's more likely that what you meant was for there to be *two*
paragraphs, not three; it's not normal to say that there is a 'blank
paragraph' between the "blah blah" and the "more more".  

You get more normal behavior with $/ = "".  In this case Perl breaks
the data into two paragraphs; the first one is "... blah blah\n\n\n\n"
and the second is "more more ...".

>Thanks, I'll play around with your suggestions if I get time off my regular
>work today. What I'm actually trying to recover is not just a character's
>lines, but also his leading cue. 

I agree that paragraph mode is definitely the way to go here.  Try
this:
        
        $character = uc shift or die "Usage: $0 character-name\n";

        $/ = "";   # Paragraph mode

        while (<>) {
          print $cue, $_ if /^\s*$character/o;
          $cue = $_;          
        }

Each time through the while loop, we read a new paragraph into $_.  If
the new paragraph begins with the appropriate character name, we print
out the previous paragraph ($cue) and the current paragraph ($_).
Then we set $cue to be the new paragraph so that it will have the
right value for the *next* time through the loop.



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

Date: Thu, 14 Sep 2000 10:28:32 -0400
From: "Dave McIntyre" <davemci@nortelnetworks.com>
Subject: copying only non-open files
Message-Id: <8pqn99$3re$1@bcarh8ab.ca.nortel.com>

We're trying to setup a cron job (SunOS) that copies and moves files via
File::Copy.

Problem is, we want to avoid the files that are active at the moment.
Is flock the answer? I also considered using the file test operator -t , but
I'm not
sure what "Filehandle is opened to a tty" means.

Any help appreciated,
Dave




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

Date: Thu, 14 Sep 2000 11:33:18 +0100
From: "Graham Wood" <graham.wood@iona.com>
Subject: Re: File name with space in Net::FTP put
Message-Id: <8pq9vd$gld$1@bvweb.iona.com>


<scarlzong@my-deja.com> wrote in message news:8pq1sg$vj$1@nnrp1.deja.com...
> In article <G0uLoH.8J3@news.boeing.com>,
>   ced@bcstec.ca.boeing.com (Charles DeRykus) wrote:
> > In article <8podbk$33j$1@nnrp1.deja.com>,  <scarlzong@my-deja.com>
> wrote:
> > >Hi,
> > >
> > >a quick question concerning Nert::FTP.
> > >
> > >I have a script using ftp to transfer files but put("$file") does not
> > >work if the file name contains space. The remote computer is a RH6.2
> so
> > >it does  support for example touch "qa dd", but $ftp->put("qa dd")
> does
> > >not work. Any ideas anyone ?
> > >
> >
> > Did you add debug, i.e. Net::FTP->new("somehost...", Debug=>1)
> >
> > hth,
> > --
> > Charles DeRykus
> >
>
>
> Yes, certainly. Sorry I forgot to put it the original message.
> I get "Bad remote filename 'qa dd'" as response. So I am pretty
> comfortable it is the Net:FTP package that has this limitation.
> ´
> I have tried put("/"qa dd/"") which doesn't work of course, but it is a
> trick like that I'm looking for. Or if anyone has any idea how to
> change Net:FTP.

The slashes are the wrong way round here although I don't know whether this
will work either - $ftp->put("\"qa dd\""). Have you tried it with single
quotes around the filename? put("'qa dd'")?


Graham Wood
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

Date: Thu, 14 Sep 2000 11:37:40 GMT
From: scarlzong@my-deja.com
Subject: Re: File name with space in Net::FTP put
Message-Id: <8pqda2$d97$1@nnrp1.deja.com>

In article <m3zolbcocu.fsf@stig.a.sol.no>,
  Stig Palmquist <stig@palmquist.org> wrote:
> ced@bcstec.ca.boeing.com (Charles DeRykus) writes:
>
> > In article <8podbk$33j$1@nnrp1.deja.com>,  <scarlzong@my-deja.com>
wrote:
> > | Hi,
> >
> > | a quick question concerning Nert::FTP.
> >
> > | I have a script using ftp to transfer files but put("$file") does
not
> > | work if the file name contains space. The remote computer is a
RH6.2 so
> > | it does  support for example touch "qa dd", but $ftp->put("qa
dd") does
> > | not work. Any ideas anyone ?
>
> You sould probably try to escape "\" the space character.
>
> Like:
>
> $filenametoupload=~ s/ /\ /g;
>
> --
> Stig Palmquist <stig@palmquist.org>
>

Thanks for all response but I found one, though ugly, solution.
For some reason the put command can't handle filenames with space but
the rename did.

$file="qa ee";
$filetoupload=$file;
$filetoupload=~ s/ /qwerty/g;
$ftp->put("$file","$filetoupload");
$ftp->rename("$filetoupload","$file");


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 14 Sep 2000 12:46:02 +0200
From: Armin Beier <beier@itt.uni-stuttgart.de>
Subject: fileevent (tcl) under perl?
Message-Id: <39C0AC6A.E52E13BF@itt.uni-stuttgart.de>

Hi Perl-Community,

I'm trying to write an application, which calls an own FORTRAN-Program
and puts the output of this program via perl/Tk to a graphical
Text-Widget.

To do this, I have to redirect the stdout of the FORTRAN-Program to a Filehandle
(no problem). But how can I notice the event that a new line has been
appended to this file to insert it to the Text-Widget?
I know that in TCL there is a function called "fileevent" which seems to
install an eventloop that starts a procedure (handler) everytime a newline is
appended to the file.

Is there a similar function in Perl too?

Please send information directly to my email-address as I'm not very often
browsing the newsgroups.

Thanks

Armin

--
Dipl.-Ing. Armin Beier
Institut fuer Techn. Thermodynamik
und Thermische Verfahrenstechnik
Universitaet Stuttgart
Pfaffenwaldring 9
70569 Stuttgart
Germany
Tel. +49 711 685-6018 Fax. +49 711 685-7657
email beier@itt.uni-stuttgart.de





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

Date: Thu, 14 Sep 2000 11:56:12 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: fileevent (tcl) under perl?
Message-Id: <w13w5.483$WSlb.3014778@news.xtra.co.nz>

I was shocked! How could Armin Beier <beier@itt.uni-stuttgart.de>
say such a terrible thing:
>Hi Perl-Community,
>
>I'm trying to write an application, which calls an own FORTRAN-Program
>and puts the output of this program via perl/Tk to a graphical
>Text-Widget.
>
>To do this, I have to redirect the stdout of the FORTRAN-Program to a Filehandle
>(no problem). But how can I notice the event that a new line has been
>appended to this file to insert it to the Text-Widget?
>I know that in TCL there is a function called "fileevent" which seems to
>install an eventloop that starts a procedure (handler) everytime a newline is
>appended to the file.
>
>Is there a similar function in Perl too?

Sure. It's called "open()" and "fork()" and "exec()" :).

# this command does an implicit fork/exec
open CHILD_COMMAND, 'fortran_command|'
    or die "Couldn't run the command: $!";

while (defined ($next_line = <CHILD_COMMAND>))
{
    # do whatever with $next_line
}

Check the documentation:

perldoc -f open
perldoc -f fork
perldoc -f exec

>Please send information directly to my email-address as I'm not very often
>browsing the newsgroups.

Well...you said please. Next time I might not be so nice, it's not so
difficult to look tomorrow or the next day for an answer.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Fortune's real live weird band names #256:

Flying Dustbunnies


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

Date: 14 Sep 2000 13:44:28 GMT
From: "Stephen O. Lidie" <lusol@Pandora.CC.Lehigh.EDU>
Subject: Re: fileevent (tcl) under perl?
Message-Id: <8pqkns$b8q@fidoii.CC.Lehigh.EDU>

Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
> I was shocked! How could Armin Beier <beier@itt.uni-stuttgart.de>
> say such a terrible thing:
>>Hi Perl-Community,
>>
>>I'm trying to write an application, which calls an own FORTRAN-Program
>>and puts the output of this program via perl/Tk to a graphical
>>Text-Widget.
>>
>>To do this, I have to redirect the stdout of the FORTRAN-Program to a Filehandle
>>(no problem). But how can I notice the event that a new line has been
>>appended to this file to insert it to the Text-Widget?
>>I know that in TCL there is a function called "fileevent" which seems to
>>install an eventloop that starts a procedure (handler) everytime a newline is
>>appended to the file.
>>
>>Is there a similar function in Perl too?

> Sure. It's called "open()" and "fork()" and "exec()" :).

And, of course, Perl/Tk has fileevent() too.

Steve
-- 
@_=map{eval"100${_}"}split/!/,'/5!*2!+$]!/10+$]';use Tk;$m=tkinit;$t='just an'.
'other perl hacker';$z='createText';$c=$m->Canvas(-wi,$_[1],-he,25)->grid;$c->$
z(@_[2,3],-te,$t,-fi,'gray50');$c->$z($_[2]-$],$_[3]-$],-te,$t);$m->bind('<En'.
'ter>',sub{$y=int(rand($m->screenheight));$m->geometry("+$y+$y")});MainLoop;


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

Date: Thu, 14 Sep 2000 12:57:21 +0200
From: =?iso-8859-1?Q?Thorbj=F8rn?= Ravn Andersen <thunderbear@bigfoot.com>
Subject: Re: Finding subdirectories on Windows Systems
Message-Id: <39C0AF11.AE3D05A3@bigfoot.com>

FX wrote:
> 
> Well when isaid verbose I meant with a tiny little sample :-)

Look into the documentation for File::Find, either on a CPAN mirror,
perl.com, or with "perldoc File::Find".

There are several examples.  You will need the -d operator to test for
whether a found item is a directory.

-- 
  Thorbjørn Ravn Andersen         "...plus...Tubular Bells!"
  http://bigfoot.com/~thunderbear


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

Date: Thu, 14 Sep 2000 12:14:26 +0200
From: Malte Ubl <ubl@schaffhausen.de>
Subject: How do I sort a list of list by a certain column
Message-Id: <39C0A502.826EBB5A@schaffhausen.de>

Hi,

I want to sort a list of lits by a certain column. An example would be
to sort
a list of the names of all the members of a family by the third member
of
the family.

I have written my one little algorithm to do this, but it is fairly
slow, so I was
wondering if there was a module to do this (havent found anything at
CPAN)
or if anybody else had a nice way to do this.

Thank You,

malte



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

Date: 14 Sep 2000 11:15:42 GMT
From: koos_pol@nl.compuware.com.NO_JUNK_MAIL (Koos Pol)
Subject: Re: How do I sort a list of list by a certain column
Message-Id: <slrn8s1cqu.76h.koos_pol@c1682.nl.compuware.com>

On Thu, 14 Sep 2000 12:14:26 +0200, Malte Ubl <ubl@schaffhausen.de> wrote:
| Hi,
| 
| I want to sort a list of lits by a certain column. An example would be
| to sort
| a list of the names of all the members of a family by the third member
| of
| the family.

Look in perlfaq4 for how to sort a hash on it's key values. It it easy to
extrapolate this approach to lists of lists.

Koos Pol
----------------------------------------------------------------------
S.C. Pol - Systems Administrator - Compuware Europe B.V. - Amsterdam
T:+31 20 3116122   F:+31 20 3116200   E:koos_pol@nl.compuware.com

Check my email address when you hit "Reply".


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

Date: 14 Sep 2000 13:44:22 GMT
From: abigail@foad.org (Abigail)
Subject: Re: How do I sort a list of list by a certain column
Message-Id: <slrn8s1lfl.ku0.abigail@alexandra.foad.org>

Malte Ubl (ubl@schaffhausen.de) wrote on MMDLXXI September MCMXCIII in
<URL:news:39C0A502.826EBB5A@schaffhausen.de>:
"" Hi,
"" 
"" I want to sort a list of lits by a certain column. An example would be
"" to sort
"" a list of the names of all the members of a family by the third member
"" of
"" the family.
"" 
"" I have written my one little algorithm to do this, but it is fairly
"" slow, so I was
"" wondering if there was a module to do this (havent found anything at
"" CPAN)
"" or if anybody else had a nice way to do this.


Noone has! It's not like something you frequently encounter, and hence
something frequently asked. Oh, no. And it isn't in the frequently 
answered questions list either. Don't bother looking!



Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$==-2449231+gm_julian_day+time);do{until($=<$#r){$_.=$r[$#r];$=-=$#r}for(;
!$r[--$#r];){}}while$=;$,="\x20";print+$_=>September=>MCMXCIII=>=>=>=>=>=>=>=>'


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

Date: Thu, 14 Sep 2000 12:46:06 +0200
From: xxx <arolfes@dds.nl>
Subject: Howto:  bidirectional and forking Socket Server
Message-Id: <iajAOacBww678JYvhMg9RHf5dvcx@4ax.com>

Hi there,

Tryin' to build a socket server which can handle multiple sessions at
a time. Beside that it should interact with the client (giving
response to the input on the socket)

Found several scripts but none of them is capable of running
(shell)programs in the code which starts upon requests on the specific
port

BTW: can anyone give me a working example of a  TCP- server using
NetServer::Generic ?

TIA


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

Date: Thu, 14 Sep 2000 17:50:32 +0300
From: Victor Koldun <lkh@class.class.lviv.ua>
Subject: Is there a good freeware/shareware IDE for PERL?
Message-Id: <39C0E5B8.6804A8FF@class.class.lviv.ua>

Hi,

I am into Perl programming for a long time, but I don't have the
Internet at home and can't work on my scripts at home. Whereas the
Internet class, where I have to work on them, keeps me for 5 minutes
waiting for my script to get uploaded/executed... and the plain text
editor seems to date back to early 70s. ANd I can't change anything,
since I'm not the boss... :(

Does anyone know of some good and freeware/shareware PERL IDE to build
and debug scripts without the Internet access? Yeah I know I want too
much! :) But the evergrowing amount of free cool software brings me
hope...

Thank you all in advance!
Yaros



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

Date: Thu, 14 Sep 2000 16:00:29 +0200
From: Paul Vandevelde <paul.vandevelde@mcd.alcatel.be>
Subject: Limitation when reading names in directory ?
Message-Id: <39C0D9FD.13402FB0@mcd.alcatel.be>

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

Hi,
I have following situation.

I have a directory with following characteristics in Unix : contains
files with a number of max 4 positions as name.
I want to process these files :
To read the names one after another I do :
    while (</ap/request/it/res/*>)
      {
         ...
      }

So this statement should give any member in that directory.
Internal I think he builds first a list with all names.
The problem now is that the command is not working if there are more
than 1711 files in there.
Can somebody say something about it. Is it true or is something wrong in
this coding. For the moment
we have more than 2000 files in there, so he skips the while
immediatetely.

Regards,
Paul

Ps. Using Perl 5.004_03



--------------9D3550544B8BB56A8CF1A86C
Content-Type: text/x-vcard; charset=us-ascii;
 name="paul.vandevelde.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Paul Vandevelde
Content-Disposition: attachment;
 filename="paul.vandevelde.vcf"

begin:vcard 
n:Vandevelde;Paul
tel;work:Methods and Tools
x-mozilla-html:FALSE
org:RCD;VG24
adr:;;F.wellesplein 1;Antwerp;;3120;Belgium
version:2.1
email;internet:paul.vandevelde@mcd.alcatel.be
title:Methods and Tools engineer
fn:Paul Vandevelde
end:vcard

--------------9D3550544B8BB56A8CF1A86C--



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

Date: Thu, 14 Sep 2000 14:24:40 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Limitation when reading names in directory ?
Message-Id: <39c0dfa8.2804$3a@news.op.net>

In article <39C0D9FD.13402FB0@mcd.alcatel.be>,
Paul Vandevelde  <paul.vandevelde@mcd.alcatel.be> wrote:
>The problem now is that the command is not working if there are more
>than 1711 files in there.

On older versions of Perl, <...> can break when the directory is very large.
Try this instead:

        $the_dir = "/ap/request/it/res" 
        opendir DIR, $the_dir
          or die "Couldn't open $the_dir: $!; aborting";
        while ($_ = readdir DIR) {
          ...
        }
        closedir DIR;



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

Date: Thu, 14 Sep 2000 11:22:28 GMT
From: patrick_k6801@my-deja.com
Subject: Perl
Message-Id: <8pqcd5$c3h$1@nnrp1.deja.com>

Hello NG,
 i am a newbie to perl and I have no questions. So please do not answer
to this posting.

But think of the following:
Why is Perl so bad?
Why is is it so slow and why did it get you so far, that you are
accepting this f...... @#$\%-syntax ?

regards,
   Patrick


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 14 Sep 2000 12:05:44 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Perl
Message-Id: <sa3w5.484$WSlb.9633956@news.xtra.co.nz>

I was shocked! How could patrick_k6801@my-deja.com <patrick_k6801@my-deja.com>
say such a terrible thing:
>Hello NG,
> i am a newbie to perl and I have no questions. So please do not answer

That's okay, even "Eddie the Eagle" had to start somewhere. I'm sure in
time with practice you will be up there on a level with "Moron-Zilla".

>But think of the following:
>Why is Perl so bad?
>Why is is it so slow and why did it get you so far, that you are
>accepting this f...... @#$\%-syntax ?

Troll-o-meter:

<------------------------------------*------------->

That's a 7.5 folks! Good effort but that low degree of difficulty score
will cost him.

Just thought I'd help get you all into the olympic spirit :)

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
F:	When into a room I plunge, I
	Sometimes find some VIOLET FUNGI.
	Then I linger, darkly brooding
	On the poison they're exuding.
		-- The Roguelet's ABC


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

Date: Thu, 14 Sep 2000 14:13:39 +0100
From: Nick Condon <nickco3@yahoo.co.uk>
Subject: Re: Perl
Message-Id: <39C0CF03.67CF0BFD@yahoo.co.uk>

patrick_k6801@my-deja.com wrote:

> Hello NG,
>  i am a newbie to perl and I have no questions. So please do not answer
> to this posting.
>
> But think of the following:
> Why is Perl so bad?
> Why is is it so slow and why did it get you so far, that you are
> accepting this f...... @#$\%-syntax ?

That's the worst troll I've ever seen. Nobody's going to bite cause it's
way, way too obvious.

Next time try a little subtlety.

Oh, and you'll need a new email address cause everybody just kf'ed this
one.
---
Nick


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

Date: Thu, 14 Sep 2000 09:59:53 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Perl
Message-Id: <Pine.GSO.4.21.0009140955470.12100-100000@crusoe.crusoe.net>

On Sep 14, Gwyn Judd said:

>I was shocked! How could patrick_k6801@my-deja.com <patrick_k6801@my-deja.com>
>say such a terrible thing:
>>But think of the following:
>>Why is Perl so bad?
>>Why is is it so slow and why did it get you so far, that you are
>>accepting this f...... @#$\%-syntax ?
>
>Troll-o-meter:
>
><------------------------------------*------------->
>
>That's a 7.5 folks! Good effort but that low degree of difficulty score
>will cost him.
>
>Just thought I'd help get you all into the olympic spirit :)

In the olympic spirit (thanks to The Onion <http://www.theonioncom/>):

=======================================================================
New Olympic Sports

The 2000 Olympic Games kick off this Friday in Sydney, Australia.  What
are some of the new medal events being introduced?

 * Table volleyball                 * 400-meter weightlifting relay
 * Equestrian diving                * Men's freestyle web-site design
 * Synchronized boxing              * Centathlon
 * Greco-Roman fscking              * Team basketball
 * Water tennis                     * Trinidad & Tobago mocking
 * 4x100 men's bonding              * Suspicous-person arresting
=======================================================================

Hmm, they don't have "Promiscuous sex" listed, even though it has been
reported that every competitor has received 51 condoms (that's 3/day).

-- 
Jeff "japhy" Pinyan     japhy@pobox.com     http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/
CPAN - #1 Perl Resource  (my id:  PINYAN)        http://search.cpan.org/



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

Date: Thu, 14 Sep 2000 10:52:24 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Perl
Message-Id: <Pine.A41.4.21.0009141048110.11234-100000@ginger.libs.uga.edu>

On Thu, 14 Sep 2000 patrick_k6801@my-deja.com wrote:
> Hello NG,
>  i am a newbie to perl and I have no questions. So please do not answer
> to this posting.
> 
> But think of the following:
> Why is Perl so bad?
> Why is is it so slow and why did it get you so far, that you are
> accepting this f...... @#$\%-syntax ?

That syntax is incorrect.  Try

print f...'...',@#,$\,%-,syntax

Brad



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

Date: Thu, 14 Sep 2000 14:16:48 GMT
From: "Matthew Wagley" <gpcu.mwagley@gcnet.com>
Subject: problem with csv cgi script
Message-Id: <k55w5.1043$Qe.101865@newshog.newsread.com>

I have a csv database and I have textarea field.  When I hit enter in the
field to start a new line and type multiple lines in and using the enter key
to start the next new line  after sending to the cgi it parses it out
totally different as if it was its on fields and stuff.  How can you parse
the enter command into a new line when parsing the information coming into
the script?
Here is the part that parses the information coming in from the form.

!!!!!!!!!This is from the very beginning of the script that parses the
webform.!!!!!!!!!

read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@cgiPairs = split(/&/,$buffer);
foreach $cgiPair (@cgiPairs)
{
  ($name,$value) = split(/=/,$cgiPair);
  $value =~ s/\+/ /g;
  $value =~ s/%(..)/pack("c",hex($1))/ge;
  $form{$name} .= "\0" if (defined($form{$name}));
  $form{$name} .= "$value";
}

!!!!!!!!!!!!From the form adding a new entry.!!!!!!!!!!!!!!!!!!!!!!

 $form{'Description'} =~ (s/\r\n/<br>/g);

 foreach $split_table_fields (@split_table_fields)
 {push (@row, "$form{$split_table_fields}");}

 $new_row = join ("\|", @row);


 open (DATABASE, ">>$data_location/$database");
 print DATABASE "$new_row\n";
 close (DATABASE);



Thanks for your help


--
Matthew Wagley
MIS Director
Golden Plains Credit Union
1714 E. Kansas Ave.
Garden City, KS  67846
316-275-2151 ext. 205







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

Date: 14 Sep 2000 13:43:04 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Problem with refresh
Message-Id: <slrn8s1ld8.ku0.abigail@alexandra.foad.org>

Tom Fotheringham (tom@hughesmedia.co.uk) wrote on MMDLXXI September
MCMXCIII in <URL:news:39C09D7B.E195BE6B@hughesmedia.co.uk>:
~~ If I make a from, the user enters the data, then if they keep refreshing
~~ the page created by the script that accepts the form, it keeps
~~ re-entering the form.
~~ 
~~ How can I redirect the user to a different page after the data has been
~~ accepted?


The WWW groups are thataway.



Abigail
-- 
perl -wle '(1 x $_) !~ /^(11+)\1+$/ && print while ++ $_'
#    Eshun dying under
#    a maple. Two flying
#    flies. A darting carp.


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

Date: Thu, 14 Sep 2000 13:54:14 +0100
From: jfp <unicon@btconnect.com>
Subject: Re: Problem with STDIN (newbie question)
Message-Id: <39C0CA76.AFC9FAC@btconnect.com>

>>I can't get it to run in Linux with this command: ./test1.pl   nor can I get
>>it to run under either of my two windows machines using Perl Builder 2.0. I
>>wonder if it's a problem with my machines.
>>Here's the error report from Perl Builder:
>>Global symbol "$name" requires explicit package name at 1.pl line 3.
>>Global symbol "$name" requires explicit package name at 1.pl line 4.
>>Global symbol "$name" requires explicit package name at 1.pl line 5.
>>Execution of 1.pl aborted due to compilation errors.

I'm also a Perl/programming newbie so I may be wrong and will be corrected by others if
that is so...but.....
I think Perl is asking for the variable $name to be declared (which I thought would
only happen with  use strict;  ?)

You already have Learning Perl, try also to buy 'Elements of Programming Perl' by
Andrew Johnson as I've found it teaches good coding practices (using -w and use strict
from the outset) and assumes nothing!

Regards

JFP
(Not Yet A Perl Hacker)





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

Date: Thu, 14 Sep 2000 07:12:44 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Qualifications for new Perl programmer?????
Message-Id: <39C0DCDC.C9544CC7@stomp.stomp.tokyo>

Bart Lateur wrote:
 
> Godzilla! wrote:
 
> >Write an imaginative and creative Perl script with a minimum
> >of five-hundred lines
 
> I have rarely ever written a Perl script of over 500 lines. I can do
> some pretty amazing stuff in under 200 lines.


Don't think I've ever written a script under five-hundred lines.
Average size for my scripts range from two-thousand lines for a
small script to five-thousand lines for a large script. Probably
the smallest script I have is one of my android scripts, Clarity,
which is twelve lines. However it has over eight kilobytes of
arrays included. My other android scripts are one-thousand lines
or more. Last night I wrote a skeleton for a new android. It is
four-hundred-forty lines already. This one will be,

Tales Of The No-Tell Motel

Scripts under two-hundred lines, kinda doubt these would be
amazing entertaining scripts but rather efficiency scripts,
housekeeping scripts of sorts, serving a good function,
no doubt.


My long experience as a woman is, shorter is often not better.

Godzilla!
-- 
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class


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

Date: Thu, 14 Sep 2000 14:29:53 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Qualifications for new Perl programmer?????
Message-Id: <Bh5w5.17142$a5.243003@news1.rdc1.mb.home.com>

In article <8pq6sd$6e1$1@nnrp1.deja.com>,
 Brendon Caligari <bcaligari@my-deja.com> wrote:
[snip]

! upsetting was a book review i saw when hunting for perl books a few
! months ago. the review said that the book teaches perl even if you
! don';t have any programming experience.
 
Why is it upsetting that a book teaches Perl programming to beginners
who have no prior programming experience? Do you feel the same way
about books that teach Pascal, or C to beginners, or is it just
introductory Perl programming books that upset you?

! I'll shoot the next guy I meet who'll say that he wants to learn
! programming and is therefore going to learn perl, vb, c..whatever.

OK, you'll shoot a beginner who wants to start with Perl, VB, or C --
what language would you recommend they start with ... oh, you already
shot them, I guess you won't be recommending anything to them.

regards,
andrew

-- 
Andrew L. Johnson   http://members.home.net/perl-epwp/
      Where the hell are my fries, kid?
          -- Tom Christiansen, on comp.lang.perl.misc


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

Date: Thu, 14 Sep 2000 13:15:42 +0100
From: David Hugh-Jones <davidhj@mail.com>
Subject: Re: sprintf() rounding problem
Message-Id: <968934567.255958610@news.uklinux.net>


I have been told in no uncertain terms that this has been covered in the FAQ
and previous posts. I apologize for not checking this before. Mea culpa. I have
now read the 114 posts I could find on deja, and the FAQ on sprintf and round.

I came to the conclusion that sprintf() wouldn't work because it sometimes
rounds .5 down, for very good mathematical reasons (as a kid I wondered why 0.5
"had to round up" - encouraging to know it doesn't). I want my rounding to round
0.5 up all the time, which I assume is the accounting convention.

So I wrote something like this:
$total=57;
$tax=17.5;
$total+=$total*$tax$0.01;
$total*=100;		#these 3 lines to round to 2 sig digits
$total+=0.5;
$total=int($total);
$total/=100;

But I still get a problem. $total is 6697.5 after multiplying by 100, and 6698
after adding 0.5. But then int($total) puts it down to 6697!

I assume the problem is that weird floating point arithmetic stuff is
making 6698 be really a bit less than 6698 before it gets integerized. But I
don't know how to work around this. One option that comes up is "do everything
in cents so you are working with integers internally". Unfortunately, I can't
do that, because my program takes external input in the form of dollars and
cents (or pounds and pence). It would be too difficult to make users calculate
everything in cents. So, I have to use floating point numbers. Is there a way
of doing rounding while ensuring that 0.5 always gets rounded up?

Thanks again, and apologies again if I have missed something obvious.

David.




On Thu, 14 Sep 2000, David Hugh-Jones wrote:
>Hi,
>
>I am developing a program which has to add Value Added Tax to an order at
>17.5%. I do this roughly as follows:
>
>$tax=17.5;
>$value=57;                                 # (for example )
>$value+=$value*$tax*0.01;       # tax is a percentage
>$value = sprintf(%.2f,$value);     # to convert $value to the nearest penny
>
>My problem is that sprintf doesn't round the numbers correctly. E.g. for
>this instance, $value is 66.975 after line 3. This should round to 66.98,
>but in fact the fourth line outputs 66.97.
>
>Could anyone tell me what I am doing wrong and how to put it right? I have
>looked at the sprintf() entry in the perlfunc man page, and also the sprintf
>man(3) page, but with no success.
>
>Thanks very much. Replies to davidhj@mail.com will be gratefully accepted!
>
>Dave


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

Date: Thu, 14 Sep 2000 12:46:11 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: sprintf() rounding problem
Message-Id: <nM3w5.489$WSlb.6553814@news.xtra.co.nz>

I was shocked! How could David Hugh-Jones <davidhj@mail.com>
say such a terrible thing:

>I came to the conclusion that sprintf() wouldn't work because it sometimes
>rounds .5 down, for very good mathematical reasons (as a kid I wondered why 0.5
>"had to round up" - encouraging to know it doesn't). I want my rounding to round
>0.5 up all the time, which I assume is the accounting convention.
>
>So I wrote something like this:
>$total=57;
>$tax=17.5;
>$total+=$total*$tax$0.01;
>$total*=100;		#these 3 lines to round to 2 sig digits
>$total+=0.5;
>$total=int($total);
>$total/=100;
>
>But I still get a problem. $total is 6697.5 after multiplying by 100, and 6698
>after adding 0.5. But then int($total) puts it down to 6697!

If you change the sixth line "$total=int($total);" to:

$total = sprintf "%f.0", $total;

Then it will do what you want (I think. It works for the example you
gave, but it's not tested really). This is because although perl says
$total is 6698 it's really more like 6697.9999999999999999998765 so when
int() chops off the integer portion ugly things happen (did you read
"perldoc -f int"). Anyway glad to see you read the advice and made an
effort.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Whatever it is, I fear Greeks even when they bring gifts.
		-- Publius Vergilius Maro (Virgil)


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

Date: Thu, 14 Sep 2000 14:27:56 GMT
From: "Cl0ud9" <Cl0ud9@mail.tds.net>
Subject: Re: Strange characters when using forms ^M
Message-Id: <01c01e59$eaeb84c0$a25400cf@cloud9>

try | through col

Kevin Metcalf <notkmetcalf@notlighthousemarketingnot.com> wrote in article
<39BFD3DE.36405F2E@notlighthousemarketingnot.com>...
> The ^M is a control character representation of a return.  When the data
> is returned, use something like:
> $value =~ s/%0D//g;
> 
> Kevin
> 
> Tom Fotheringham wrote:
> 
> > I use:
> >
> > $data=$q->param("whatever");
> >
> > ,when recieving info from a TEXT AREA, I get a couple of ^M
> >
> > Can anyone please point me in the right direction as how to get TEXT
> > AREA information to work as a normal text field?
> >
> > Please and Thanks
> > Tom
> 
> 


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

Date: Thu, 14 Sep 2000 14:56:29 +0100 (BST)
From: Smylers-usenet@stripey.com (Smylers)
Subject: Re: Test Your Perl Skills
Message-Id: <2000Sep14.135630.7637@leeds.ac.uk>

Richard J. Rauenzahn <nospam@hairball.cup.hp.com> uttered something
along the lines of:

> I'll never get hired.  I failed this question: <Snip>

I particularly liked:

  [perlop]What is the result of the following operation?
  5 

  3
  a. 1
  b. 3
  c. 5
  d. 7

I had to admit defeat and cheat.

Apparently, the correct answer is "e".

Smylers



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

Date: Thu, 14 Sep 2000 11:32:33 GMT
From: pscola@tiscalinet.it (Paolo)
Subject: tranferring a file on remote host
Message-Id: <39c0b74e.17397351@news.tiscalinet.it>

Hi everibody.

I would know how it is possible 
to transfer a file ( locally generated )
on a remote host,  only using perl libraries. 

Thanks in advance for your help, 
regards.

Paolo


PS:
a possible reply will be appreciated also at:
paolo_scola@rcm.inet.it



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

Date: Thu, 14 Sep 2000 13:11:20 +0100
From: "Graham Wood" <graham.wood@iona.com>
Subject: Re: tranferring a file on remote host
Message-Id: <8pqfn7$hc0$1@bvweb.iona.com>

I'm not sure I understand entirely what you mean by "only using perl
libraries".  There is a perl module Net::FTP that implements FTP file
transfer without using external FTP client calls but it does rely on there
being an FTP server on the remote machine. libnet is the package to download
from www.CPAN.org

Graham Wood


Paolo <pscola@tiscalinet.it> wrote in message
news:39c0b74e.17397351@news.tiscalinet.it...
> Hi everibody.
>
> I would know how it is possible
> to transfer a file ( locally generated )
> on a remote host,  only using perl libraries.
>
> Thanks in advance for your help,
> regards.
>
> Paolo
>
>
> PS:
> a possible reply will be appreciated also at:
> paolo_scola@rcm.inet.it
>




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

Date: Thu, 14 Sep 2000 22:19:21 +0900
From: "sang" <laoxiu100@hotmail.com>
Subject: UNICODE & SSI
Message-Id: <8pqj33$f45$1@nn-os106.ocn.ad.jp>

Hi,alls

Why i  cannot use SSI in UNICODE file?

Thanks in advance!



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

Date: Thu, 14 Sep 2000 14:05:32 +0300
From: "sakis doupas" <adoupas@xanthi.ilsp.gr>
Subject: use of locale in win32 version of perl
Message-Id: <8pqbbi$2fvp$1@ulysses.noc.ntua.gr>

Hi,
Can somebody help me with the use of locale in windows?
the following commands couse perl to crash

use POSIX qw(locale_h);
setlocale(LC_CTYPE, "el_GR.ISO8859-7");

I have the activestate version of perl 5.6




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

Date: 14 Sep 2000 15:39:59 GMT
From: hymie@lactose.smart.net (hymie!)
Subject: Re: Working with IP addresses
Message-Id: <8pqrgf$qn0$1@news.smart.net>

In our last episode, the evil Dr. Lacto had captured our hero,
  the_crowbar@my-deja.com, who said:

>Starting IP:   10.1.1.1
>Ending IP:     10.1.2.5
>
>I want the script to act on 10.1.1.1-10.1.1.255 and 10.1.2.1-10.1.2.5. I

ummm... did you mean 10.1.2.0-10.1.2.5 ?

>cannot figure out the logic the script needs to be able to count through
>the IPs. Any ideas/pointers/code snipets etc is greatly appreciated.

Option 1:

Convert the two IP addresses from base-256 numbers into base-10 numbers.
Then, as you iterate between your starting and ending point, convert
the base-10 numbers back to base-256 IP addresses.

$base10=unpack("L",join '',map chr,reverse split(/\./,$ip));

$ip = join '.',unpack("C*",reverse pack ("L",$base10));   

(Now ... I'm very proud of this little snippet, because I'm Just Another
Perl Hacker Wannabe.  So I'm not sure if I should invite you to admire
it, or pick it apart and teach me.  :)

hymie!          http://www.smart.net/~hymowitz          hymie@lactose.smart.net
===============================================================================
I tell [my husband], "The tuna is behind the milk."  But he won't move the
milk.  Becuase if he moves the milk, and the tuna isn't there, the milk won.
                                                                  --Rita Rudner
===============================================================================


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 4322
**************************************


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