[17982] in Perl-Users-Digest
Perl-Users Digest, Issue: 142 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 25 14:57:29 2001
Date: Thu, 25 Jan 2001 11:05:16 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <980449516-v10-i142@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 25 Jan 2001 Volume: 10 Number: 142
Today's topics:
CGI Question <cason@skio.peachnet.edu>
Re: CGI Question <bart.lateur@skynet.be>
Re: change tmp dir for file upload in cgi soleblazer@my-deja.com
Comparing multiple values datastar@my-deja.com
Re: Comparing multiple values <bart.lateur@skynet.be>
Re: Comparing multiple values (Mark Jason Dominus)
Re: Date and time (Mark Jason Dominus)
DSN, Perl, db Connection (Michael Stoic)
Re: Error Message <dfreeman@rathis.com>
Re: FAQ 1.3: Which version of Perl should I use? <lmoran@wtsg.com>
Re: FileHandle Question? <mjcarman@home.com>
Re: FileHandle Question? <us004258@mindspring.com>
forcing compile errors on undeclared vars? iwelch@my-deja.com
FreezeThaw. <a565a87@my-deja.com>
Re: help wanted DBI & oracle (Garry Williams)
How can I trap an https posting error used SSLeay befor <kdinh@commerce-tv.com>
Re: huh? <lwebbee@britcomtele.comnotreal>
Re: Iterating through matches to a regexp ? <Jerome.Abela@free.fr>
Re: Newbie Perl Problem <bart.lateur@skynet.be>
Re: perl editors <prlawrence@lehigh.edu>
Re: perl editors <amonotod@netscape.net>
Re: perl editors <djberge@uswest.com>
Re: perl editors <bart.lateur@skynet.be>
Re: perl editors <lmoran@wtsg.com>
Re: perl editors <nospam@nospam.com>
Re: perl editors <hanja@my-deja.com>
Re: Perl for Palm? <randy.galbraith@pegs.com>
Re: Perl is bad at (very) simple math! <mischief@velma.motion.net>
Re: Perl is bad at (very) simple math! michal@gortel.phys.ualberta.ca
Re: Perl is bad at (very) simple math! <nospam@nospam.com>
Re: PerlCGI writing to STDIN of another prog speedpk@my-deja.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 25 Jan 2001 13:21:09 -0500
From: "Horace J. Cason" <cason@skio.peachnet.edu>
Subject: CGI Question
Message-Id: <3A706E95.4A620648@skio.peachnet.edu>
I am writing a cgi reservation system in perl for where i work and i was
curious is there anyway to get perl to save the values in the form if
there is an error so the user doesnt have to enter all the data again.
I would find it irritating to have to do that myself. I have tried using
the self_url() method to get it to save the values but it ends up just
resetting the form. I use the print qq! way to create the forms and i
save the parameters coming off the form into variables. The script is
working right just wanting to get some error detection involved. Also is
there a way to prevent 2 or more users from reserving an item at the
same time?
------------------------------
Date: Thu, 25 Jan 2001 18:34:40 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: CGI Question
Message-Id: <q6s07t40poav21mtmcor1elphae3g00p0l@4ax.com>
Horace J. Cason wrote:
>I am writing a cgi reservation system in perl for where i work and i was
>curious is there anyway to get perl to save the values in the form if
>there is an error so the user doesnt have to enter all the data again.
That is off-topic for this newsgroup, but you probably want one of the
following:
* hidden form variables
* ordinary text input boxes, where you set the value
* dropdown and listboxes, where you set the SELECTED attribute for that
paricular item
* multiline text boxes, or "textarea", where you have to put the
original text between the opening "<textarea>" tag, and the closing
"</textarea>" tag.
Don't forget to HTML-escape all values (e.g. "&" must be turned into
"&").
Or: you can just tell them to use the "back" button.
--
Bart.
------------------------------
Date: Thu, 25 Jan 2001 16:19:42 GMT
From: soleblazer@my-deja.com
Subject: Re: change tmp dir for file upload in cgi
Message-Id: <94pjmi$jvj$1@nnrp1.deja.com>
Hello, I am looking at my Cgi.pm file but do not see a comment to tell
me how to send my cgi requests to another location besides /tmp. Do
you think you could tell me how to do it or paste your comment section
into a post?
Tks,
Justin
In article <3a6f88d8.524144494f47414741@radiogaga.harz.de>,
martin@radiogaga.harz.de wrote:
> venkatmohan@my-deja.com wrote:
> > Is it possible to change the temporary directory where the files are
> > uploaded (through the input type file html form item).
> >
> > By default it uploads to /var/tmp I want to change this directory to
> > some other directory.
>
> It uses the first of
>
> /usr/tmp
> /var/tmp
> /tmp
> /temp
> /Temporary Items
> .
>
> it can find. To set it, use
>
> BEGIN { $TempFile::TMPDIRECTORY = '/your/directory' }
> use CGI;
>
> or see the comment at the beginning of CGI.pm to set it system-wide.
>
> cu,
> Martin
> --
> One OS to rule them all | Martin Vorlaender | VMS & WNT
programmer
> One OS to find them | work: mv@pdv-systeme.de
> One OS to bring them all | http://www.pdv-
systeme.de/users/martinv/
> And in the Darkness bind them.| home: martin@radiogaga.harz.de
>
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 25 Jan 2001 17:39:42 GMT
From: datastar@my-deja.com
Subject: Comparing multiple values
Message-Id: <94pocs$osn$1@nnrp1.deja.com>
What I'm trying to do seems so simple, but I can't find a simple way to
do it in Perl.
I can say:
if ($somevar==3) { } # do something
...but what if I want to test if $somevar equals 3,4,8 or 9?
I know I could say:
if ($somevar==3 || $somevar==4 || $somevar==8 || $somevar==9) { }
...but that can get unwieldy. Isn't there a way to say something like:
if ($somevar==3,4,8,9)
I know I can accomplish this using pattern matching, but I'd rather
avoid that for simplicity if possible.
Any thoughts appreciated!
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 25 Jan 2001 18:42:19 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Comparing multiple values
Message-Id: <2hs07tknsts8j8b2qaqnj8t79vf3u56i5r@4ax.com>
datastar@my-deja.com wrote:
>I can say:
>
> if ($somevar==3) { } # do something
>
>...but what if I want to test if $somevar equals 3,4,8 or 9?
>
>I know I could say:
>
> if ($somevar==3 || $somevar==4 || $somevar==8 || $somevar==9) { }
>
>...but that can get unwieldy. Isn't there a way to say something like:
>
> if ($somevar==3,4,8,9)
>
>I know I can accomplish this using pattern matching, but I'd rather
>avoid that for simplicity if possible.
You know what, this is a FAQ. I don't think it is IN the FAQ, but this
question has been asked here at least 3 times in the last month. You can
see Deja for recent discussions.
For what it's woth, you can easily use one of the following:
* a hash. You can even simulate a switch control structure with hashes.
Simple:
%accepted = ( 3 => 1, 4 => 1, 8 => 1, 9 => 1);
if($accepted{$somevar) { ... }
More complex:
%whattodo = ( 3 => \&casea, 4 => \&casea, 8 => \&casea, 9 =>
\&casea, 16 => \&caseb, 18 => \&caseb );
sub casea { print "This is case A\n" };
sub caseb { print "This is case B\n" };
($whatdodo{$somevar} || sub { print "Oops. Default.\n" })->();
* grep()
$somevar = 9;
if(grep { $_ == $somevar } 3, 4, 8, 9) {
print "Yup.\n";
}
Some people worry about efficiency, especially if the test list is
large.
--
Bart.
------------------------------
Date: Thu, 25 Jan 2001 18:48:30 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Comparing multiple values
Message-Id: <3a7074f5.18e7$c9@news.op.net>
Keywords: fetish, gallstone, ninefold, yokel
In article <94pocs$osn$1@nnrp1.deja.com>, <datastar@my-deja.com> wrote:
>I know I could say:
>
> if ($somevar==3 || $somevar==4 || $somevar==8 || $somevar==9) { }
>
>...but that can get unwieldy. Isn't there a way to say something like:
>
> if ($somevar==3,4,8,9)
One way to accomplish that is to make a table that expresses the
meaning of what you are trying to say:
# 0 1 2 3 4 5 6 7 8 9
@is_interesting = (0, 0, 0, 1, 1, 0, 0, 0, 1, 1);
or
@is_interesting[3,4,8,9] = (1) x 4;
Then to do the test, use:
if ($is_interesting[$some_var]) { ... }
By giving @is_interesting a suitable name ("@requires_confirmation" or
"@is_currency_value" or whatever) you can make your code more
communicative.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Thu, 25 Jan 2001 19:04:07 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Date and time
Message-Id: <3a7078a6.1935$78@news.op.net>
In article <94pdue$eptr$1@as121.tel.hr>, MaxyM <marekpow@email.hinet.hr> wrote:
>I wonder if it is possible that Perl reads data from the Web Page and
>then store data to a file,
Get LWP::Simple module from CPAN.
http://search.cpan.org/
Then use:
use LWP::Simple;
getstore('http://perl.plover.com/', 'my-file.html');
> and also write date and time when data
>arrives.
The OS will do this for you. Use
$time = localtime((stat('my-file.html'))[9]);
to get the time that 'my-file.html' was written.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Thu, 25 Jan 2001 16:47:14 GMT
From: stoic@speakeasy.org (Michael Stoic)
Subject: DSN, Perl, db Connection
Message-Id: <3a7057e4.4272320@news.speakeasy.org>
I am trying to test MS Access db connectivity through Perl script and
DSN. The sever is NT4 with IIS and ActivePerl 5.6 with a DBI and ODBC
modules installed.
Perl file = "inserttest.pl"
DSN = "cb1"
The Perl code db connection string is:
***
my $dbh = DBI->connect("dbi:ODBC:driver=Microsoft Access Driver
(*.mdb);dbq=dbtest.mdb")
or die "Can't connect to the database: $DBI::errstr\n";
***
I keep getting the following error:
***
DBI->connect(driver=Microsoft Access Driver (*.mdb);dbq=cb1) failed:
[Microsoft][ODBC Driver Manager] Invalid string or buffer length
(SQL-S1090)(DBD: db_login/SQLConnect err=-1) at
D:\html\users\rats\html\cgi-bin\insert_test.pl line 11
Can't connect to the database: [Microsoft][ODBC Driver Manager]
Invalid string or buffer length (SQL-S1090)(DBD: db_login/SQLConnect
err=-1)
***
I can see that the Perl code is not talking to the db. For a complete
novice: Is it the Perl code or an indication of system error? If code,
can you suggest an alternative way to make the connection?
Many Thanks!
~Michael
stoic@speakeasy.org
PS Copy of complete Perl file below:
#!/usr/bin/perl
use CGI ':standard';
use DBI;
my $name = param('name'); #"Steve";
my $country = param('country'); #"England";
my $school = param('school'); #"Henley";
my $dbh = DBI->connect("dbi:ODBC:driver=Microsoft Access Driver
(*.mdb);dbq=dbtest.mdb")
or die "Can't connect to the database: $DBI::errstr\n";
my $sth = $dbh->prepare(qq{
INSERT INTO school_info (name, country,
school)
VALUES ('$name', '$country', '$school')
})
or die "Can't prepare SQL statement: $DBI::errstr\n";
$sth->execute()
or die "Can't execute SQL statement: $DBI::errstr\n";
$dbh->disconnect()
or warn "Error disconnecting: $DBI::errstr\n";
------------------------------
Date: Thu, 25 Jan 2001 11:13:12 -0500
From: "Dustin" <dfreeman@rathis.com>
Subject: Re: Error Message
Message-Id: <t70k5gdqt004ac@corp.supernews.com>
Brent,
I am running NT4 on my local system.
The was no metion of fork() in any documentation that a got with the script.
What is it? This is only the 5th script that i have set up and I have been
doing pretty good until now.
Dustin
"Brent Dax" <brentdax1_@_earthlink.net> wrote in message
news:1DXb6.8651$KJ3.535169@newsread2.prod.itd.earthlink.net...
>
> Hash: SHA1
>
> "Dustin" <dfreeman@rathis.com> wrote in message
> news:t70gja9ehe3vb8@corp.supernews.com...
> > I'm very new to Perl/cgi programming and I am getting an error with
> > a recently acuirred script . I'm running Apache web server on my
> > local machine for testing purposes then transfering them to a WinNt
> > server. The error i'm getting is "couldn't spawn child process:" I
> > have know idea what this is telling me.
>
> Is your local machine a Windows one? Last I checked, WinNT didn't
> support fork(), which would mean any script with fork() would be
> useless. Check the ActiveState release notes on that one though, I'm
> not sure.
>
>
> Version: PGPfreeware 6.5.3 for non-commercial use <http://www.pgp.com>
>
> iQA/AwUBOnBGHLJgQ5JqNEGyEQJBUwCg3H0Su6emC8/YmpTVgRGAS9fNFpAAn3uw
> sKO86+25jRdSxMgkfhd1Ukgg
> =0DW3
> -----END PGP SIGNATURE-----
>
>
>
------------------------------
Date: Thu, 25 Jan 2001 13:42:40 -0500
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: FAQ 1.3: Which version of Perl should I use?
Message-Id: <0ss07tsrldho60v5c8usr57pbdtcq41v7t@4ax.com>
On 25 Jan 2001 14:00:32 +0100, jacklam@math.uio.no (Peter J. Acklam)
wrote wonderful things about sparkplugs:
>$\="\n";$_='The quick brown fox jumps over the lazy dog';print +(split
>//)[20,5,24,31,3,36,14,12,31,1,2,11,9,23,33,29,35,15,32,36,7,8,28,29];
cool... They ought to have an FAQ on how this works
lmoran@wtsgSPAM.com
print "\x{263a}"
------------------------------
Date: Thu, 25 Jan 2001 08:46:45 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: FileHandle Question?
Message-Id: <3A703C55.6DBC88A6@home.com>
knb50@my-deja.com wrote:
> martin@radiogaga.harz.de wrote:
>>> knb50@my-deja.com wrote:
>>> Is this completely illegal?--to use the same FileHandle
>>> for different files? or am I completely insane at this point?
>>
>> No and no.
>>
>>[...]
>
> Just so as to let you know, though, it was necessary
> for the for loop
Unless you actually care what the loop index is, a C style loop is never
needed, and usually just obscures (albeit mildly) what you're really
doing. Or was the index needed by the "do the program stuff here..."
part?
> and I was using wildcards. You're pretty perceptive!
Then you need to use glob() to perform the expansion.
> I'm just going to have to do it the hard way without
> a loop, but it's only five files.
Why do you think you can't loop? Nothing you've told us would preclude
that. You just need to tweak your approach a bit:
my @file_patterns = ('*.f1', '*.f2', *.f3', '*.f4', '*.f5');
foreach my $pattern (@file_patterns) {
my @matching_files = glob($pattern);
foreach my $file (@matching_files) {
open(FILE, $file) or die "Can't open '$file' [$!]\n";
# do something useful...
close(FILE);
}
}
-mjc
------------------------------
Date: Thu, 25 Jan 2001 13:20:35 -0500
From: "Art Heyman" <us004258@mindspring.com>
Subject: Re: FileHandle Question?
Message-Id: <94pqjc$1bj$1@slb7.atl.mindspring.net>
Images of orcs at keyboards with Gates in the background - very cute.
Eric Bohlman <ebohlman@omsdev.com> wrote in message
news:94onic$7r6$2@bob.news.rcn.net...
> Art Heyman <us004258@mindspring.com> wrote:
> > One OS to rule them all | Martin Vorlaender | VMS & WNT
programmer
> > One OS to find them | work: mv@pdv-systeme.de
> > One OS to bring them all |
> > http://www.pdv-systeme.de/users/martinv/
> > And in the Darkness bind them.| home: martin@radiogaga.harz.de
>
> > In the land of Mordor where the shadow lies ??? Yikes !
>
> s/Mordor/Redmond/;
>
------------------------------
Date: Thu, 25 Jan 2001 16:42:57 GMT
From: iwelch@my-deja.com
Subject: forcing compile errors on undeclared vars?
Message-Id: <94pl2e$lb6$1@nnrp1.deja.com>
is it possible to force perl at compile time to check whether package
variables have really been declared
(using "our")?
#!/usr/bin/perl -w
use strict;
use p1;
use strict;
print "hello";
print "variable 1 is ".$p::var1."\n";
print "variable 2 is ".$p::var2."\n"; # NOT DEFINED #print
"compile-error".$compileerror."\n";
and p1.pm is
package p;
use strict;
our $var1="defined";
1;
I would like the perl compiler to die with an error telling me that it
never saw an "our $var2" declaration in
module p.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 25 Jan 2001 16:27:47 GMT
From: Rob <a565a87@my-deja.com>
Subject: FreezeThaw.
Message-Id: <94pk5k$khj$1@nnrp1.deja.com>
I have Win NT 4, and the MLDBM module I want to build seems to want
FreezeThaw and/or Storable, both of which I subsequently downloaded
from CPAN. Storable seems to have installed OK, but when a reattempt
is made to build MLDMB, it seems to ask for FreezeThaw.
Here's the results from a build of FreezeThaw:
C:\perl\MLDBM module\MLDBM-2.00>nmake test && nmake install
Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
C:\perl\5.6.0\bin\MSWin32-x86\perl.exe -Mblib -Ic:perl\5.6.0\
lib\MSWin32-x86 -Ic:\perl\5.6.0\lib -e "use Test::Harness qw
(&runtests $verbose); $verbose=0; runtests @ARGV;" t\dumper.t
t\freezethaw.t t\storable.t
Using C:/perl/MLDBM module/MLDBM-2.00.blib
t\dumper............ok
t\freezethaw........ok 4/4FAILED test 1
Failed 1/4 tests, 75.00% okay
t\storable..........skipped test on this platform
Failed Test Status Wstat Total Fail Failed List of failed
-------------------------------------------------------------
t\freezethaw.t 4 1 25.00% 1
1 test skipped.
Failed 1/3 test scripts, 66.67% okay. 1/8 subtests failed, 87.50%
okay.
NMAKE : fatal error U1077: 'C:\perl\5.6.0\bin\MSWin32-x86\
perl.exe' : return code '0xff'
Stop.
Can anyone help me decipher this and point the way to a module that is
acceptable to my platform? Thank you for any help that you can provide.
-Rob
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 25 Jan 2001 17:28:51 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: help wanted DBI & oracle
Message-Id: <nnZb6.537$GF2.17937@eagle.america.net>
On Thu, 25 Jan 2001 17:04:15 +0100, Millet Regis <rmillet@enssat.fr> wrote:
>could anyone help me to find the problem in this connection line??
>
>$dbh = DBI->connect('dbi:Oracle:', usr,pwd);
>
>it gives me the error:
>
>DBI->connect failed: Error while trying to retrieve text for error
>ORA-12545 (DBD ERROR: OCIServerAttach)
I can't help, but the Oracle documentation can. Look up the
`ORA12545' error code to see what Oracle is complaining about.
Also, the `...usr,pwd);' bit is wrong. Those bare words should be
corrected. Enabling warnings will tell you that.
--
Garry Williams
------------------------------
Date: Thu, 25 Jan 2001 16:30:04 -0000
From: Khuong H. Dinh <kdinh@commerce-tv.com>
Subject: How can I trap an https posting error used SSLeay before dying?
Message-Id: <t70l4cprrmk533@corp.supernews.com>
Hi there,
I'm looking for a way to trap errors of sending an https post used SSLeay
and exit script. For example, after I perform the post action:
use Net::SSLeay qw(get_https post_https sslcat make_headers make_form);
use MIME::Base64;
($page, $response, %reply_headers )
= post_https('www.samplecompany.com', 443, '/path/RequestForm',
$headers, $post_str);
Is there anyway to trap the error while sending the post?
Appreciate any help!!!
Khuong.
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Date: Thu, 25 Jan 2001 18:48:12 +0000
From: Lee Webb <lwebbee@britcomtele.comnotreal>
Subject: Re: huh?
Message-Id: <94psd1$55r$1@neptunium.btinternet.com>
Because the command line to call perl located in
/usr/test/ap_cp/perl5/bin/perl would be greater than 32 characters (a
limitation on some systems), the funny looking construct is a work around.
If perl *is* installed in /usr/local/bin/perl5 on your machine, then you
would be OK to have #!/usr/local/bin/perl5 as the command.
Lee.
hanja wrote:
> I came across these two lines at the top of a script, and I am curious
> of what they mean.
>
>
> #!/bin/sh--#-*-perl-*-
> eval 'exec /usr/test/ap_cp/perl5/bin/perl -S $0 ${1+"$@"}' if 0;
>
>
> I think the first line is invoking PERL. Howerver, is there an
> advantage of using that line over "#!/usr/local/bin/perl5"?
>
> -hanja
------------------------------
Date: Thu, 25 Jan 2001 17:08:51 GMT
From: Jerome Abela <Jerome.Abela@free.fr>
Subject: Re: Iterating through matches to a regexp ?
Message-Id: <3A705CA3.93C85BA5@free.fr>
tmark@my-deja.com a écrit :
> I have a regexp - say, 'A{1,}B{1,}', and a target string (say,
'A+B+'. But maybe your 1s are to be replaced by something else at run
time ?
> 'AAABBB'). Is there a way to iterate through possible matches to this
> regexp, returning, for instance, 'AB', 'AAB', 'AABB', etc. ?
Mmmh. You have many problems, here:
- you don't want matching to eat the original string, so you need some
sort of zero-width look-ahead.
- the matching operator are either greedy (A* matches 'AAA') or
non-greedy (A*? matches ''), they are not in between.
What you need is a way to trace what the backtracking engine is finding.
Here is a solution, where the m/// operator always fails (?!), thus
forcing the backtracking engine to enumerate all the alternatives which
are stored during the iterations (?{}):
'aaabbb'=~m/(a+b+)(?{push @res, $1})(?!.|$)/g;
print join('/', @res);
The result is: aaabbb/aaabb/aaab/aabbb/aabb/aab/abbb/abb/ab
Jerome.
------------------------------
Date: Thu, 25 Jan 2001 17:51:01 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Newbie Perl Problem
Message-Id: <qsp07t489n33bcu1b80u26ogre8829acdd@4ax.com>
badass101@my-deja.com wrote:
>I have a variable, $text1, which is full of text.
>I want to strip the whitespace and new lines out of the file so that i
>get a list of words, seperated by a space,
>
>e.g.
>word1 word2 word3
>
>How can i do this easily??
You only can, if there's no punctuation in that file. I doubt that.
You don't say what do to when there IS punctuation.
--
Bart.
------------------------------
Date: Thu, 25 Jan 2001 09:21:05 -0600
From: "Phil R Lawrence" <prlawrence@lehigh.edu>
Subject: Re: perl editors
Message-Id: <94pg91$578@fidoii.CC.Lehigh.EDU>
"hanja" <hanja@my-deja.com> wrote:
> Out of curiousity, what editor do you use to write your scripts?
TextPad
Phil R Lawrence
------------------------------
Date: Thu, 25 Jan 2001 16:56:22 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: perl editors
Message-Id: <94plrf$m46$1@nnrp1.deja.com>
In article <94np7f$483$1@nnrp1.deja.com>,
hanja <hanja@my-deja.com> wrote:
> Out of curiousity, what editor do you use to write your scripts?
>
> -hanja
>
> Sent via Deja.com
> http://www.deja.com/
>
UltraEdit
http://www.ultraedit.com/
Highly configurable, converts DOS<->*nix/Mac & ASCII<->EBCDIC &
OEM<->ANSI, has HEX edit, macros, search and replace - both for open
files and files in a specified directory/subdirectory, edits over FTP,
very long history buffer per open file, gobs of formatting options,
overall very cool IMHO.
The only con is that it's not free. You can try it out for 90 days, and
if you like then buy it. If you like but not enough to buy it, simply
delete uedit.ini and uedit.cfg from the %WinDir% and start your trial
period over...
Okay, two cons: It's only for Macroshaft platforms...
HTH,
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 25 Jan 2001 11:23:03 -0600
From: Daniel Berger <djberge@uswest.com>
Subject: Re: perl editors
Message-Id: <3A7060F7.BB9A61E9@uswest.com>
hanja wrote:
> Out of curiousity, what editor do you use to write your scripts?
>
> -hanja
>
> Sent via Deja.com
> http://www.deja.com/
Visual SlickEdit
------------------------------
Date: Thu, 25 Jan 2001 17:45:40 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: perl editors
Message-Id: <agp07tk2rv9m1c8r8gd8k8ucag88l7bp0p@4ax.com>
hanja wrote:
>Out of curiousity, what editor do you use to write your scripts?
GWDedit (<www.gwdsoft.com>). A simple but effective text editor fro
Win32, with crude syntax highlighter for Perl, and possibility to run
perl.exe as a "tool", and capture the output into a new editr window.
--
Bart.
------------------------------
Date: Thu, 25 Jan 2001 12:54:45 -0500
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: perl editors
Message-Id: <e2q07t0nalefhokegmpusoju4mhctrbfh4@4ax.com>
On Thu, 25 Jan 2001 06:09:52 GMT, Mario <m_ario@my-deja.com> wrote
wonderful things about sparkplugs:
>
>> Out of curiousity, what editor do you use to write your scripts?
Xemacs
lmoran@wtsgSPAM.com
print "\x{263a}"
------------------------------
Date: 25 Jan 2001 18:38:57 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: perl editors
Message-Id: <94prs1$plc$3@216.155.32.53>
In article <94np7f$483$1@nnrp1.deja.com>, hanja <hanja@my-deja.com>
wrote:
| Out of curiousity, what editor do you use to write your scripts?
|
BBEdit Lite mostly <http://www.barebones.com/>, although I'm considering
investing in the full version 6.0.2 recently released.
Occasionally the editor built-in to MacPerl
Occasionally vim, when I'm testing on unix.
heard about some other Mac text editors like Alpha, but haven't tried
them yet.
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Thu, 25 Jan 2001 18:40:04 GMT
From: hanja <hanja@my-deja.com>
Subject: Re: perl editors
Message-Id: <94pru3$sii$1@nnrp1.deja.com>
Thanks everyone!
-hanja
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 25 Jan 2001 10:48:03 -0700
From: "Randy Galbraith" <randy.galbraith@pegs.com>
Subject: Re: Perl for Palm?
Message-Id: <94posb$bqn$1@freepress.anasazi.com>
Joshua,
In a recent interview Larry Wall talked about why Perl has not _yet_ been
ported to PalmOS. Your Perl code may appear small but the Perl interpreter
itself is rather large.
For example on SunOS my Perl 5.6.0 is...
$ ls -l /usr/local/bin/perl
-rwxr-xr-x 2 root other 1127248 Jan 12 18:02 /usr/local/bin/perl*
The gist of what Larry was saying, as I understand it, was Perl 6.0 will
expand the syntax of the language to allow current built-ins like 'sort' to
be coded as Perl modules, thus shrinking the overall size of the
interpreter. Of course, as memory gets cheaper and denser, perhaps the
thought of a 1mb binary (+ runtime memory requirements of course) won't be a
huge issue.
- Randy Galbraith
allNIC.net wrote in message
<160120010205351995%lifeoneuropa@hotmailnospam.com>...
>Greetings,
>
>Does anyone know of any PDAs which have decent Perl ports?
>
>If so, please email me at: joshwa@sonic.net
>
>
>Thanks!
>-joshua
------------------------------
Date: Thu, 25 Jan 2001 17:41:38 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Perl is bad at (very) simple math!
Message-Id: <t70pai1fh08r2b@corp.supernews.com>
philhibbs@my-deja.com wrote:
> In article <t6ui3ecdn4pn39@corp.supernews.com>,
> Chris Stith <mischief@velma.motion.net> wrote:
>> I wouldn't call that failing. Figure out for yourself how to
>> represent 0.1 in binary.
> Well, I'd use one of the x87 BCD floating point formats, if I was doing
> it on an Intel CPU.
I might do the same if I was going to run _only_ on Intel
x86 CPU-based machines. One of Perl's greatest strengths
is its portability. I the core had a different math engine
for every platform...
Chris
--
Christopher E. Stith
Parking for people we like only. All other vehicles will be vandalized.
------------------------------
Date: 25 Jan 2001 17:53:14 GMT
From: michal@gortel.phys.ualberta.ca
Subject: Re: Perl is bad at (very) simple math!
Message-Id: <94pp6a$7o2$1@pulp.srv.ualberta.ca>
philhibbs@my-deja.com wrote:
> abigail@foad.org wrote:
>> get rid of the idea that doing floating point
>> arithmetic using binary computers that consist of
>> a finite amount of atoms is actually feasible.
> I disagree - there's even an IEEE format for BCD floating point, and
> IIRC the x87 FPU supports it. I may be wrong about that. It's an option
> that my father and I were considering implementing in a Basic
> interpreter that we wrote in the 80s.
And how that would help you with with numbers not representable in a
decimal notation or with a representation too long for capacities of
your format? Or you are an accountant which habitually rounds
everything to two decimal places in a fraction? Mind you, this is still
rounding but maybe you are so used to it that you stopped notice that?
Michal
------------------------------
Date: 25 Jan 2001 18:18:56 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: Perl is bad at (very) simple math!
Message-Id: <94pqmg$plc$2@216.155.32.53>
In article <comdog-49AC2B.04553525012001@news.panix.com>, brian d foy
<comdog@panix.com> wrote:
| In article <94oo7v$q7d$1@216.155.33.13>, The WebDragon
| <nospam@nospam.com> wrote:
|
| > In article <t6ui3ecdn4pn39@corp.supernews.com>, Chris Stith
| > <mischief@velma.motion.net> wrote:
|
| > | I wouldn't call that failing. Figure out for yourself how to
| > | represent 0.1 in binary.
| > |
| > | There is such a thing as arbitrary precision mathematics, but
| > | computer hardware tend snot to support it. Perl uses the math
| > | capabilities present in the host platform.
|
| > as clear a description of Windows as I've ever heard. And probably the
| > most useful function to apply Windows to.
|
| this has nothing to do with Windows. it's a digital computer thing.
|
| --[339]$ perl -le 'print 5.1 - 5'
| 0.0999999999999996
| --[340]$ uname -a
| NetBSD ---- 1.4.3 NetBSD 1.4.3 (-----USER) #0: Tue Dec 19 12:25:51 EST
| 2000
| root@juggler.panix.com:/devel/netbsd/1.4.3/src/sys/arch/i386/compile/PANI
| X-USER i386
heh no, I was referring to his typo [sic],
"There is such a thing as arbitrary precision mathematics, but computer
hardware tend snot to support it"
sounds like a very low-level subsistence just to get arbitrary precison
:D
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Thu, 25 Jan 2001 16:34:39 GMT
From: speedpk@my-deja.com
Subject: Re: PerlCGI writing to STDIN of another prog
Message-Id: <94pkiu$kpj$1@nnrp1.deja.com>
> Maybe because you write $daten instead of $data into Writer ? Or is it
> just a typo in your post ?
>
> Jerome.
>
Just an error in my post ... and $daten is definitely not empty.
Greetings
Arne Bippes
Sent via Deja.com
http://www.deja.com/
------------------------------
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 V10 Issue 142
**************************************