[16907] in Perl-Users-Digest
Perl-Users Digest, Issue: 4319 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 14 00:07:30 2000
Date: Wed, 13 Sep 2000 21: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: <968904311-v9-i4319@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 13 Sep 2000 Volume: 9 Number: 4319
Today's topics:
[OT] Re: Fun with SDL, OpenGl and Perl (Gwyn Judd)
Re: Aliasing problem <tim@ipac.caltech.edu>
Re: Aliasing problem <tim@ipac.caltech.edu>
Apache/perl cgi-bin question ? <peterp100@hotmail.com>
CGI.pm with explorer 5.0 (newbie question) (Robert Delisle)
Re: Compiling SSLeay on Solaris 8 <mfaine@bellsouth.net>
Re: Determining the length of a string <aqumsieh@hyperchip.com>
Re: E-Commerce scripts (Martien Verbruggen)
Re: Function to convert whole + fractions to decimal nu <davesisk@ipass.net>
golf (Was Re: transliterating file names in a dir) <stephenk@cc.gatech.edu>
Re: help in writing a card game (Gwyn Judd)
Re: insert a string to a file <aqumsieh@hyperchip.com>
Re: insert a string to a file (Chris Fedde)
Re: main process should not wait for externally started (Gwyn Judd)
Re: NDBM_File.pm question <bwalton@rochester.rr.com>
Re: NDBM_File.pm question <louis@lilith1.demon.co.uk>
Re: Need help with CGI re: FormMail.pl <juex@deja.com>
Re: OFF TOPIC IGNORE Re: killfiles? scores? I wish I <danny@lennon.postino.com>
Perl on AS/400 <quattro@skyblue.ocn.ne.jp>
Re: Perl vs. Java or C++ <biow@verity.com>
Re: Problem with STDIN (newbie question) <ren.maddox@tivoli.com>
Re: Problem with STDIN (newbie question) <mtaylorlrim@my-deja.com>
Re: Problem with STDIN (newbie question) <nuklearsite@crosswinds.net>
Re: Problem with STDIN (newbie question) <krazykat@welikekrazykat.com>
Re: Reading piped input on Windows NT bursell@my-deja.com
select and sysread <kj0@mailcity.com>
Re: Silly grep tricks (Alan Barclay)
Re: slick way to look at array? (Damian Conway)
Re: slick way to look at array? <lauren_smith13@hotmail.com>
Re: Teaching Perl (Abigail)
Re: transliterating file names in a dir <mtaylorlrim@my-deja.com>
Re: transliterating file names in a dir <ren.maddox@tivoli.com>
Re: transliterating file names in a dir <uri@sysarch.com>
Re: web and site searching <marcopolotravel@ifrance.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 14 Sep 2000 01:40:41 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: [OT] Re: Fun with SDL, OpenGl and Perl
Message-Id: <slrn8s0b4m.727.tjla@thislove.dyndns.org>
I was shocked! How could Thomas Åhlen <thomas2@dalnet.se>
say such a terrible thing:
>You should check this page out!
>There are both screenshots and source.
>
>You can do much fun with perl..:)
>
>http://www.metaverse.fsnet.co.uk/sdlpl/
Ouch! You really really need to make those images a bit smaller. 454kB
for an image that is the size of a thumbnail...no thanks :)
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
No guest is so welcome in a friend's house that he will not become
nuisance after three days.
-- Titus Maccius Plautus
------------------------------
Date: Wed, 13 Sep 2000 18:42:23 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: Aliasing problem
Message-Id: <39C02CFF.1FE48AC0@ipac.caltech.edu>
Thomas Hutchings wrote:
[code snipped]
> My client code is this:
>
> #Client
> use B();
>
> my $obj = B->new(); #######
> $obj->import(); # import vars into Lang namespace #######
>
> print "$B::Test is the string directly.\n";
> print "$Lang::Test is the string from Lang, aka " . ${"Lang::Test"} . "\n";
>
> Which on execution prints out:
>
> Hello World is the string directly.
> is the string from Lang, aka Hello World
>
> Why does the symbolic reference ${"Lang::Test"} print correctly, while the
> direct reference $Lang::Test does not? My perl is 5.00503 on AIX.
It's a compile-time vs. runtime issue. If you enclose the lines with #######
next to them in a BEGIN block, it works as I presume you expect it to:
Hello World is the string directly.
Hello World is the string from Lang, aka Hello World
--
-- Tim Conrow tim@ipac.caltech.edu |
------------------------------
Date: Wed, 13 Sep 2000 20:13:05 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: Aliasing problem
Message-Id: <39C04241.F3508E4A@ipac.caltech.edu>
Tim Conrow wrote:
>
> Thomas Hutchings wrote:
>
> [code snipped]
>
Of course I snipped a key part of the puzzle. Clue 2 is that if you comment out
the line
undef %{Lang::};
... it will also work.
I must confess I haven't been able to work out exactly what's going on. I guess
I'll watch for an answer from someone with more experience points.
--
-- Tim Conrow tim@ipac.caltech.edu |
------------------------------
Date: Wed, 13 Sep 2000 23:12:33 -0400
From: peter <peterp100@hotmail.com>
Subject: Apache/perl cgi-bin question ?
Message-Id: <rsf0sso5vfh8q8k5v94ku9b4tisof7sj9h@4ax.com>
I want to place my perl cgi files in the same dir as my html files.
How do I do set up permissions to do this ?
I'm using Mandrake 7.1.
Thanks,
peter
------------------------------
Date: Thu, 14 Sep 2000 02:12:41 GMT
From: Groupesr@sympatico.ca (Robert Delisle)
Subject: CGI.pm with explorer 5.0 (newbie question)
Message-Id: <39c94567.1058676@news1.sympatico.ca>
HI
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).
Thanks
Robert
------------------------------
Date: Wed, 13 Sep 2000 22:06:43 -0500
From: "Mark Faine" <mfaine@bellsouth.net>
Subject: Re: Compiling SSLeay on Solaris 8
Message-Id: <RhXv5.10173$%p.60716@news1.atl>
I'm not real familiar with SSLeay, why do you need it if you have OpenSSL?
As for the probelm, doesn't look like you are using gcc to me.
You might try setting CC=gcc ?
After that the first thing I would do is get gcc-2.95.x ,it's available as
tar.gz or pkgadd. Sun cc sucks.
Also might want to look at www.activestate.com, I'm not certain but if thier
version of perl for Solaris comes with ppm you might not have to compile the
module yourself at all.
-Mark
"Ralf Wiegand" <rwiegand@tmltechnologies.com> wrote in message
news:39AD3CBD.3C1200DA@tmltechnologies.com...
> Hello Group -
> I'm trying to compile SSLeay and I'm getting the following error
> message:
>
> cp SSLeay.pm blib/lib/Net/SSLeay.pm
> AutoSplitting blib/lib/Net/SSLeay.pm (blib/lib/auto/Net/SSLeay)
> blib/lib/Net/SSLeay.pm: some names are not unique when truncated to 8
> characters
> :
> directory blib/lib/auto/Net/SSLeay:
> ssl_read_all.al, ssl_read_until.al, ssl_read_CRLF.al truncate to
> ssl_read
> ssl_write_all.al, ssl_write_CRLF.al truncate to ssl_writ
> /usr/bin/perl -I/usr/perl5/5.00503/sun4-solaris -I/usr/perl5/5.00503
> /usr/perl5/
> 5.00503/ExtUtils/xsubpp -typemap /usr/perl5/5.00503/ExtUtils/typemap
> -typemap t
> ypemap SSLeay.xs >xstmp.c && mv xstmp.c SSLeay.c
> cc -c -I/usr/local/ssl/include -xO3 -xdepend -DVERSION=\"1.05\"
> -DXS_VERSI
> ON=\"1.05\" -KPIC -I/usr/perl5/5.00503/sun4-solaris/CORE SSLeay.c
> cc: unrecognized option `-KPIC'
> cc: language depend not recognized
> cc: SSLeay.c: linker input file unused since linking not done
> Running Mkbootstrap for Net::SSLeay ()
> chmod 644 SSLeay.bs
> LD_RUN_PATH="/usr/local/ssl/lib" cc -o
> blib/arch/auto/Net/SSLeay/SSLeay.so -R/us
> r/local/ssl/lib -G SSLeay.o -L/usr/local/ssl -L/usr/local/ssl/lib
> -lssl -lcry
> pto
> cc: SSLeay.o: No such file or directory
> *** Error code 1
> make: Fatal error: Command failed for target
> `blib/arch/auto/Net/SSLeay/SSLeay.s
> o'
>
> The system is a SS5/256MB RAM/2.8, OpenSSL installed OK, using GCC.2.8.1
> etc...
> (OpenSSL.0.9.4, SSLeay.1.0.5)
> I would like to run webmin with SSL support, but the only thing what is
> not working is the compiling of SSLeay.
>
> Thank YOU
> Ralf Wiegand
> wiegandr@hourglass.com
>
------------------------------
Date: Thu, 14 Sep 2000 03:53:29 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Determining the length of a string
Message-Id: <7absxrpr2c.fsf@merlin.hyperchip.com>
Jeff Pinyan <jeffp@crusoe.net> writes:
> On Sep 13, rathmore@tierceron.com said:
>
> >$data = "This is my data";
> >$_ = $data;
> >$length = tr/a-zA-Z0-9 //;
> >print "The string $data has $count characters.";
>
> Obfuscation alert.
>
> y ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc;
Good one :-)
But I can beat you at golf:
y cccc;
;-)
--Ala
------------------------------
Date: Thu, 14 Sep 2000 01:43:29 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: E-Commerce scripts
Message-Id: <slrn8s0b9e.2cp.mgjv@verbruggen.comdyn.com.au>
[please, in the future, post your reply after the suitably shortened
text you reply to. It's the convention used in this newsgroup, and it
makes much more sense, because it parallells chronology. Thanks]
On Thu, 14 Sep 2000 09:23:20 +1100,
Splezunk <splezunk@usa.net> wrote:
[Post reordered to obey natural flow of time]
> "Jevon MacDonald" <jevon@islandtelecom.com> wrote in message
> news:bIKv5.8$JP6.7771@sapphire.mtt.net...
> > > PS. Flat file access is preferable over database access.
> >
> > No it's not.
>
> I know that :)
>
> I am a Data Warehouse Technician. But in this particular instance, I am
> only interested in a flat file solution. It would be nice to set up an
> Oracle Database that it connects to, but I am trying to get this thing set
> up with as little cost as possible... Once the Money starts pouring in, I
> can look at more robust solutions that use Databases.
\begin{offtopic}
There are perfectly capable free[1] RDBMS's out there, The two most
popular ones are Postgres and MySQL, Postgres being the better in
general[2]. Neither of the two takes much effort setting up, if you
already have experience with another RDBMS.
\end{offtopic}
If you use DBI with a suitable driver, you won't have to rewrite your
code (much), even if you decide to use flat files now, Postgres next
week, and Oracle the week after. DBI has drivers (in the DBD:: name
space) that support flat files, and all major RDBMS's out there. You
can find DBI and the drivers, and many other Perl modules, at
http://www.cpan.org/
DBI also has a dedicated space on the Web at
http://www.symbolstone.org/technology/perl/DBI
Martien
[1] But read the license agreements!
[2] better compliance to SQL standards, more featureful, more robust,
faster on writes (outperforming even Oracle and Sybase), better
scaling to large numbers of transactions and/or user connections.
MySQL is faster for read-only (or very few writes) databases with few
connections.
--
Martien Verbruggen |
Interactive Media Division | The world is complex; sendmail.cf
Commercial Dynamics Pty. Ltd. | reflects this.
NSW, Australia |
------------------------------
Date: Thu, 14 Sep 2000 02:19:57 GMT
From: "David Sisk" <davesisk@ipass.net>
Subject: Re: Function to convert whole + fractions to decimal numbers?
Message-Id: <hBWv5.3388$IV1.1144189@typhoon.southeast.rr.com>
Thanks very much for the help!
David Sisk <davesisk@ipass.net> wrote in message
news:kuNv5.2847$IV1.896394@typhoon.southeast.rr.com...
> I'm thinking in terms of stock quotes here. Does Perl have any built-in
> functions to convert (for example) "67 3/4" to "67.75"?
>
> Best regards,
> Dave
>
>
>
------------------------------
Date: Wed, 13 Sep 2000 23:52:45 -0400
From: Stephen Kloder <stephenk@cc.gatech.edu>
Subject: golf (Was Re: transliterating file names in a dir)
Message-Id: <39C04B8C.48B38120@cc.gatech.edu>
Uri Guttman wrote:
>
> this is more what the OP wanted:
>
> $file =~ tr/A-Z /a-z-/ ;
>
> and in a loop it would be:
>
> tr/A-Z /a-z-/ for @files ;
>
This is starting to look like a golf problem: Rename all filenames in the
current directory so that all letters are lowercase, and all spaces are
replaced with dashes.
My submission:
perl -e 'rename"$_",(tr/A-Z /a-z-/+1&&$_)for(<*>)'
--
Stephen Kloder | "I say what it occurs to me to say.
stephenk@cc.gatech.edu | More I cannot say."
Phone 404-874-6584 | -- The Man in the Shack
ICQ #65153895 | be :- think.
------------------------------
Date: Thu, 14 Sep 2000 01:48:27 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: help in writing a card game
Message-Id: <slrn8s0bj8.727.tjla@thislove.dyndns.org>
I was shocked! How could Yanick Champoux <yanick@babyl.sympatico.ca>
say such a terrible thing:
>Yanick (who will stop before someone notice that
> this is offtopic, and smell of warmth and
> fuzziness..)
*sniff sniff* Smell of something anyway :)
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Life is short. Don't be a dick.
-bumber sticker
------------------------------
Date: Thu, 14 Sep 2000 02:09:18 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: insert a string to a file
Message-Id: <7aem2npvw0.fsf@merlin.hyperchip.com>
nodo70@my-deja.com writes:
> Where is FAQs? Sorry being dum here.
FAQs stand for "Frequently Asked Questions". I can safely say that more
than 90% of most questions posted to this newsgroup are answered
directly in the FAQs.
If you have Perl properly installed, then you should have all the docs
and FAQs already installed on your system. Type
perldoc perldoc
on the command line to familiarize yourself with the soon-to-be-obsolete
perlfaq tool.
You can also access the docs and FAQs by accessing the corresponding
links on the left hand side of the www.perl.com website.
--Ala
------------------------------
Date: Thu, 14 Sep 2000 03:18:55 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: insert a string to a file
Message-Id: <zsXv5.140$W3.171106816@news.frii.net>
In article <8ponis$gc2$1@nnrp1.deja.com>, <nodo70@my-deja.com> wrote:
>
>Where is FAQs? Sorry being dum here.
>
This kind of puzzled me...
$ perldoc -q faq
No documentation for perl FAQ keyword `FAQ' found
Anyway...
perldoc perlfaq
chris
--
chris fedde
303 773 9134
------------------------------
Date: Thu, 14 Sep 2000 01:36:20 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: main process should not wait for externally started executable
Message-Id: <slrn8s0ash.727.tjla@thislove.dyndns.org>
I was shocked! How could but86@my-deja.com <but86@my-deja.com>
say such a terrible thing:
>Hello programmers!
Hi!
>I am building a daemon that calls other shell programmes.
>When I use system() or backticks, it waits until the other programm is
>done. It gets an bit problematic, if this hangs or runs too long (well,
perldoc -q "How do I start a process in the background?"
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
What's a cult? It just means not enough people to make a minority.
-- Robert Altman
------------------------------
Date: Thu, 14 Sep 2000 02:20:48 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: NDBM_File.pm question
Message-Id: <39C0361D.8F43DB7B@rochester.rr.com>
louis wrote:
...
> I am fairly new to Perl so please bear with me if this question seems
> stupid.
>
> I am trying to get to grips with interfacing to databases and have been
> trying to get a simple test program to work.
>
> Some may know this so I'll include the info :
> cgidb.cgi - from Perl Black book - requires NDBM_File.pm and
> dynaload.pm apart from others.
>
> Running locally on Sambar server (Win98) - latest Active perl etc.
>
> This example puts up a HTML page with two forms that allow a dbase to be
>
> created by adding elements and a search routine.
>
> I get an error when running this module which all seems to come down to
> the following line in NDBM_file.pm :
>
> $Version = "1.01";
> bootstrap NDBM_File $Version;
>
> The message I get if run at the dos prompt is "can't locate loadable
> object for module NDBM_File in @INC .."
>
> If I comment out the bootstrap line it runs but doesn't write the
> database file. I presume that the message is telling me that it can't
> find the "bootstrap" routine.
> Looking in dynaload.pm there is a bootstrap subroutine.
>
> Can anyone tell me what the problem is (I know this may not be enough
> information but I am hoping that someone knows the code I am using from
> the Black book or knows about this problem). Perhaps it is something to
> do with running this on Windows platform although most things seem to
> work ok.
>
> Louis
NDBM is only available on Unix or Unix-like platforms. It is not
available on Windoze. Since you are on Windoze 98, you have a FAT32
file system, so SDBM won't work either. Therefore, use DB_File.
--
Bob Walton
------------------------------
Date: Thu, 14 Sep 2000 04:40:13 +0100
From: louis <louis@lilith1.demon.co.uk>
Subject: Re: NDBM_File.pm question
Message-Id: <39C0489C.1E9E6D0E@lilith1.demon.co.uk>
Bob Walton wrote:
> louis wrote:
> ...
> > I am fairly new to Perl so please bear with me if this question seems
> > stupid.
> >
> > I am trying to get to grips with interfacing to databases and have been
> > trying to get a simple test program to work.
> >
> > Some may know this so I'll include the info :
> > cgidb.cgi - from Perl Black book - requires NDBM_File.pm and
> > dynaload.pm apart from others.
> >
> > Running locally on Sambar server (Win98) - latest Active perl etc.
> >
> > This example puts up a HTML page with two forms that allow a dbase to be
> >
> > created by adding elements and a search routine.
> >
> > I get an error when running this module which all seems to come down to
> > the following line in NDBM_file.pm :
> >
> > $Version = "1.01";
> > bootstrap NDBM_File $Version;
> >
> > The message I get if run at the dos prompt is "can't locate loadable
> > object for module NDBM_File in @INC .."
> >
> > If I comment out the bootstrap line it runs but doesn't write the
> > database file. I presume that the message is telling me that it can't
> > find the "bootstrap" routine.
> > Looking in dynaload.pm there is a bootstrap subroutine.
> >
> > Can anyone tell me what the problem is (I know this may not be enough
> > information but I am hoping that someone knows the code I am using from
> > the Black book or knows about this problem). Perhaps it is something to
> > do with running this on Windows platform although most things seem to
> > work ok.
> >
> > Louis
>
> NDBM is only available on Unix or Unix-like platforms. It is not
> available on Windoze. Since you are on Windoze 98, you have a FAT32
> file system, so SDBM won't work either. Therefore, use DB_File.
> --
Thanks Bob,
I was going mad trying to trace the problem and had suspicions that it was a
platform issue.
Not clear from the book or docs.
I had discovered through a little debugging that the "object" that dynaloader
was trying to find was NDBM_File.dll and which
made sense if a file system interface was needed. I can go to bed now. :-)
Regards
Louis
>
> Bob Walton
------------------------------
Date: Wed, 13 Sep 2000 18:11:17 -0700
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: Need help with CGI re: FormMail.pl
Message-Id: <39c025b7@news.microsoft.com>
"Theodore Hansson" <hansson@uswest.net> wrote in message
news:TtVv5.98$e96.7418@news.direcpc.com...
> Hi you CGI experts,
Wrong NG, this one is called comp.lang.perl.misc
jue
------------------------------
Date: 14 Sep 2000 01:39:08 GMT
From: <danny@lennon.postino.com>
Subject: Re: OFF TOPIC IGNORE Re: killfiles? scores? I wish I had these luxuries
Message-Id: <8ppa7s$c73$1@lennon.postino.com>
User-Agent: tin/1.4.2-20000205 ("Possession") (UNIX) (Linux/2.2.14-5.0 (i586))
Russ Jones <russ_jones@rac.ray.com> wrote:
> "Godzilla!" wrote:
>> Use of killfiles is for
>> weenies and bigots.
>>
> plonk and this time it's for good.
There must be something wrong with my news reader, tin. I have killfiled
this witch a dozen times, but she keeps coming back. HELLLPPPPP!!!!
--
Danny Aldham Providing Certified Internetworking Solutions to Business
www.postino.com E-Mail, Web Servers, Web Databases, SQL PHP & Perl
------------------------------
Date: Thu, 14 Sep 2000 10:25:19 +0900
From: "OCN" <quattro@skyblue.ocn.ne.jp>
Subject: Perl on AS/400
Message-Id: <8ppaer$kn0$1@nn-os106.ocn.ad.jp>
Hello,
I had atempt to make Perl objects from source codes in AS/400 V4R5M0.
But unfortunately not only because of not QShell utility, also some C
programs failed in
compile by command CRTCMOD. (Doio and others)
Is there anybody who have been successfull in Perl object compiling in
AS/400 ?
Please let me know how to do that.
I hope your kindly advise.
Thanks.
Kazuaki Ikeda.
OfficeQuattro Co,.Ltd
Japan
***********************************
Kazuaki Ikeda
Office Quattro Co.,Ltd. from Japan
E-mail : quattro@skyblue.ocn.ne.jp
HomePage: http://www.officequattro.com
Phone : +81-6-6993-7870
Fax : +81-6-6993-8746
***********************************
------------------------------
Date: Wed, 13 Sep 2000 21:50:25 -0400
From: Christopher Biow <biow@verity.com>
Subject: Re: Perl vs. Java or C++
Message-Id: <vlb0ssgs65m9ecqrgq7l62q7k9gcl4mmcm@4ax.com>
rathmore@tierceron.com wrote:
>My question is, should I continue to learn Perl?
Yes. It will greatly expand your versatility and the jobs for which you'll
be qualified. It's also fun.
>Is the demand for Perl programmers high?
Relative to supply, yes. My company has openings that require Perl going
wanting, despite what I regard as outstanding salary, benefits, conditions,
etc.
>Higher than Java or C++?
See Larry Wall's last State of the Onion address for some numbers of
relative openings advertised on dice.com. To what degree that represents
demand, or demand relative to supply, I'm not sure.
It would be interesting to also have numbers for responses received within
24 hours of posting a resume on a jobs site, for different classes of
skills. I suspect that some of the hot Java acronyms would garner the most
responses, right now. Looking ahead a few years...no one knows.
>What types of projects could
>a good Perl program look forward to working on, vs. those for Java or
>C++ programmers?
Speaking for my current job, Perl is used to adapt search software to the
customer's needs, including cron/at jobs, CGI code, DBI gateways, API
encapsulation via Perl packages, and daemons/services. Java is used for
servlets, beans, EJBs, and JSPs. C/C++ is seeing less and less use outside
of core applications.
------------------------------
Date: 13 Sep 2000 20:00:37 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Problem with STDIN (newbie question)
Message-Id: <m3zolbdbyi.fsf@dhcp11-177.support.tivoli.com>
"kk" <krazykat@welikekrazykat.com> writes:
> I am new to perl, so I apologize for the newbie question. My problem is that
> when using the code from the "Learning Perl" manual, I am unable to get the
> program to pause (and accept my name) after I prompt for user input.
> According to the book, the <STDIN> construct is there for that reason. Am I
> missing something here? I'm convinced that I am, because the result is the
> same in Linux or Win98.
>
> #!/usr/bin/perl
Stick a -w on there, particularly if something isn't working. It
doesn't help in this case but it often will. (Not to mention the need
for "use strict;", but I'll leave that for another time.)
> print "What is your name?\n" ;
> $name = <STDIN>;
> chomp ($name);
> print "Hello, $name!\n;
Missing a " there, but that isn't the problem, just a typo.
> which returns these lines:
> What is your name
> Hello,
>
> So, if someone could point out what I have done wrong, I'd be very grateful.
How, exactly, are you trying to run this? I expect that whatever
method you are using is not resulting in STDIN being available to the
script. For example, if you do this:
$ perl
#!/usr/bin/perl
print "What is your name?\n" ;
$name = <STDIN>;
chomp ($name);
print "Hello, $name!\n";
^D
Then STDIN is not available to the script as perl used it to read the
script. I expect that you are doing something similar. Ah, perhaps
you are doing:
$ perl < script_file
which has exactly the same problem. Instead, either leave out the
"<", or (on Linux, at least) make the script executable (chmod +x
script_file) and then simply run it directly:
$ script_file
Run this way, your script works fine for me (after adding the missing
quote).
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Thu, 14 Sep 2000 01:34:07 GMT
From: Mark <mtaylorlrim@my-deja.com>
Subject: Re: Problem with STDIN (newbie question)
Message-Id: <8pp9ue$642$1@nnrp1.deja.com>
Perl can do some very strange things sometimes, with only a slight
error. Try closing your quote on the last line.
#!/usr/bin/perl
print "What is your name?\n" ;
$name = <STDIN>;
chomp ($name);
print "Hello, $name!\n";
Such a minor thing, and may not even cause it, but it's worth a try.
Mark
In article <39c01f25$1_3@california.uncensored-news.com>,
"kk" <krazykat@welikekrazykat.com> wrote:
> I am new to perl, so I apologize for the newbie question. My problem
is that
> when using the code from the "Learning Perl" manual, I am unable to
get the
> program to pause (and accept my name) after I prompt for user input.
> According to the book, the <STDIN> construct is there for that
reason. Am I
> missing something here? I'm convinced that I am, because the result
is the
> same in Linux or Win98.
>
> #!/usr/bin/perl
> print "What is your name?\n" ;
> $name = <STDIN>;
> chomp ($name);
> print "Hello, $name!\n;
>
> which returns these lines:
> What is your name
> Hello,
>
> So, if someone could point out what I have done wrong, I'd be very
grateful.
>
> John Davis
> krazykatNOSPAM@inreach.net
>
> ______________________________________________________________________
> Posted Via Uncensored-News.Com - Still Only $9.95 -
http://www.uncensored-news.com
> With Servers In California, Texas And Virginia - The Worlds
Uncensored News Source
>
>
--
Please reply to this newsgroup as my Deja mail
is used as a spam catcher only!
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 14 Sep 2000 03:03:57 GMT
From: "cwin17" <nuklearsite@crosswinds.net>
Subject: Re: Problem with STDIN (newbie question)
Message-Id: <xeXv5.45124$E_6.18220198@news3.rdc1.on.home.com>
I ran your code and the only thing that I needed to change to get it to work
properly was the ending quote (") on the second print statement:
#!/usr/bin/perl
print "What is your name?\n" ;
$name = <STDIN>;
chomp ($name);
print "Hello, $name!\n"; # you missed a quote here.
--
cwin17
http://www.confusion.ipfox.com
------------------------------
Date: Wed, 13 Sep 2000 20:20:43 -0700
From: "kk" <krazykat@welikekrazykat.com>
Subject: Re: Problem with STDIN (newbie question)
Message-Id: <39c044b0$1_8@california.uncensored-news.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.
______________________________________________________________________
Posted Via Uncensored-News.Com - Still Only $9.95 - http://www.uncensored-news.com
With Servers In California, Texas And Virginia - The Worlds Uncensored News Source
------------------------------
Date: Thu, 14 Sep 2000 01:06:57 GMT
From: bursell@my-deja.com
Subject: Re: Reading piped input on Windows NT
Message-Id: <8pp8b6$4dc$1@nnrp1.deja.com>
In article <8pm1lp$a3h$1@nnrp1.deja.com>,
Brendon Caligari <bcaligari@my-deja.com> wrote:
> In article <8pm00q$86t$1@nnrp1.deja.com>,
> charlie.bursell@healthcare.com wrote:
> > How, or can, I get piped data in perl on Windows NT?
> >
> > For example, if I enter "type foo | myperl" in Windows NT, how do I
> read
> > the data. The data IS NOT availabl via STDIN as in Unix.
> >
> > Thanks
> >
> > Charlie
>
> i presume myperl is a perl script...say.. "thing.pl", where pl is
> asscociated with the perl interpreter.
>
> try:
>
> type foo | perl myperl.pl
>
> Brendon
> ++++
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
I guess this shows my ignorance of Windoze. I just grabbed "type" as an
example. The real is if I have a perl script which writes to STDOUT and
then try to pipe that through another perl script. If myperl and
yourperl are both perl scripts then yourperl | my perl does not work.
If within the myperl script i say $in = <STDIN>; and then print "I GOT:
$in\n", I get onley "I GOT:" . I hope this is clearer.
Perhaps the real problem is the way perl write to STDOUT?
Charlie
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 13 Sep 2000 21:21:19 -0400
From: kj0 <kj0@mailcity.com>
Subject: select and sysread
Message-Id: <8pp96f$9o6$1@panix3.panix.com>
I find the documentation for select and sysread in the camel book very
unclear. Where can I find an example that uses both (select to find a
file descriptor from which to read and sysread to read from it)?
(I should add that my code works OK if I ignore the camel book's
unequivocal warning against mixing select and < >. But if I heed the
warning and use sysread instead of < > my code hangs.)
Thanks,
KJ
------------------------------
Date: 14 Sep 2000 01:34:02 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: Silly grep tricks
Message-Id: <968895240.227134@elaine.furryape.com>
In article <MPG.142967c4e26ba40298979a@localhost>,
jason <elephant@squirrelgroup.com> wrote:
>kj0 .. no you can't .. grep will iterate over all the elements of the
>LIST that it is passed .. you can't break out of it .. what you want is
>something more like a for loop (but not a regular for loop - because it
>localises the elements and you can't see them when the loop is over)
It's a bit inefficent, cause it won't break, but it's possible to do this:
#!/usr/local/bin/perl -w
my @a= qw(this tat theother red green blue);
print "",(grep { /e/ } @a)[0],"\n";
Note, if you pass it to print, you'll have to force the parser to not
interpt the parenthesis as a function, that's what the useless "" is for.
If you simply want to assign it to a scalar, then
$scalar=(grep { /e/ } @a)[0];
will work fine.
------------------------------
Date: 14 Sep 2000 01:27:50 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: slick way to look at array?
Message-Id: <8pp9im$d6u$1@towncrier.cc.monash.edu.au>
Cynthia Rossbach <crossbach@atgi.net> writes:
>Hi Folks,
>What is a slick way to do the following (one liner perferred):
>$answer = Is ("tt Admin" or "Admin" or "tt Assign") in @groups ?
use Quantum::Superpositions;
$answer = any("tt Admin", "Admin", "tt Assign") eq any(@groups);
Damian
------------------------------
Date: Wed, 13 Sep 2000 19:09:16 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: slick way to look at array?
Message-Id: <8ppbrh$ic$1@brokaw.wa.com>
Damian Conway <damian@cs.monash.edu.au> wrote in message
news:8pp9im$d6u$1@towncrier.cc.monash.edu.au...
> Cynthia Rossbach <crossbach@atgi.net> writes:
>
> >Hi Folks,
>
> >What is a slick way to do the following (one liner perferred):
>
> >$answer = Is ("tt Admin" or "Admin" or "tt Assign") in @groups ?
>
> use Quantum::Superpositions;
> $answer = any("tt Admin", "Admin", "tt Assign") eq any(@groups);
Wow! O(1)! You can't beat that!
Lauren
------------------------------
Date: 14 Sep 2000 01:35:00 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Teaching Perl
Message-Id: <slrn8s0ao4.ku0.abigail@alexandra.foad.org>
Adam Trace Spragg (spragg@cs.ucdavis.edu) wrote on MMDLXXI September
MCMXCIII in <URL:news:8pp5bk$83o$1@mark.ucdavis.edu>:
\\
\\ I decided to describe Perl (and general) programming to my girlfriend recentl
\\ (who is a recent math major graduate). I described variables and values, and
\\ that went well. If a=5 and b=6, then c=a+b would result in c being 11. It
\\ was when I said that you could do "c=c+1" that she sort of flipped out. In
\\ a math sense, "c=c+1" rarely ever makes sense. :) Also, if c is reassigned
\\ c+1, then when would the cycle stop? Etc, etc.
So, teach her Haskell, or some other side effect free language.
Abigail
--
# Perl 5.6.0 broke this.
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
------------------------------
Date: Thu, 14 Sep 2000 01:20:20 GMT
From: Mark <mtaylorlrim@my-deja.com>
Subject: Re: transliterating file names in a dir
Message-Id: <8pp944$563$1@nnrp1.deja.com>
Try this...
$filename =~ tr/[A-Z]/[a-z]; #change case
$filename =~ tr/\s/-/; # convert whitespace to -
I'm sure someone will put that on one line..
Mark
In article <8pp7hc$3e0$1@nnrp1.deja.com>,
pault4282@my-deja.com wrote:
> I have been trying with little success to transform a directory with a
> large number of file whose names contain capital letters and white
> spaces, to names which have now uppercase letters and which have
dashes
> (-) instead of white space. For example:
>
> Some file in My directory.jpg would become
> some-file-in-my-directory.jpg
>
> I have been using opendir and glob and foreach tr =~ A-Z/a-z/-/c but
> nothing seems to work. I recieve an error: transliteration pattern
not
> terminated. Any suggestions?
>
> thanks
>
> paul
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
--
Please reply to this newsgroup as my Deja mail
is used as a spam catcher only!
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 13 Sep 2000 20:04:35 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: transliterating file names in a dir
Message-Id: <m3wvgfdbrw.fsf@dhcp11-177.support.tivoli.com>
pault4282@my-deja.com writes:
> I have been trying with little success to transform a directory with a
> large number of file whose names contain capital letters and white
> spaces, to names which have now uppercase letters and which have dashes
> (-) instead of white space. For example:
>
> Some file in My directory.jpg would become
> some-file-in-my-directory.jpg
>
> I have been using opendir and glob and foreach tr =~ A-Z/a-z/-/c but
> nothing seems to work. I recieve an error: transliteration pattern not
> terminated. Any suggestions?
The original camel book had a script called "rename" that would apply
arbitrary perl code to filenames. You would use it like:
$ rename 'tr/A-Z /a-z-/' *
worked like a champ. I don't have it handy, but I believe all of the
scripts from the original camel book are available somewhere on the
web.
Of course, using the above transliteration directly in your existing
code may also solve the immediate problem.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Thu, 14 Sep 2000 01:46:52 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: transliterating file names in a dir
Message-Id: <x7itrzhhiv.fsf@home.sysarch.com>
>>>>> "M" == Mark <mtaylorlrim@my-deja.com> writes:
M> Try this...
M> $filename =~ tr/[A-Z]/[a-z]; #change case
M> $filename =~ tr/\s/-/; # convert whitespace to -
M> I'm sure someone will put that on one line..
and correct them both as well.
you didn't close the first tr expression and the [] are useless. they
just translate [ to [ and ] to ]. tr does not use [] for char classes.
\s is a regex meta char. tr does not have metachars so that is a plain s
being converted to -
this is more what the OP wanted:
$file =~ tr/A-Z /a-z-/ ;
and in a loop it would be:
tr/A-Z /a-z-/ for @files ;
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Thu, 14 Sep 2000 06:00:38 +0200
From: marco polo travel <marcopolotravel@ifrance.com>
Subject: Re: web and site searching
Message-Id: <39C04D65.D9D66496@ifrance.com>
> Hi!
There is one at www.FluidDynamics.com but CNN and other news site
forbids searches by robots so that won't work for CNN.
For news only, I suggest you check out www.moreover.com - they provide a
free news feed - and you can customise it till your heart content.
Drop me a line if you need more information
Cheers.
HKFE
>
> I am trying to automate my news reading with perl.
>
> Thanks!
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
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 4319
**************************************