[16333] in Perl-Users-Digest
Perl-Users Digest, Issue: 3745 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 19 09:05:33 2000
Date: Wed, 19 Jul 2000 06:05:19 -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: <964011919-v9-i3745@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 19 Jul 2000 Volume: 9 Number: 3745
Today's topics:
Array - how do I found out how many elements are in one <jed@speedfreak.com>
Re: Array - how do I found out how many elements are in (Bernard El-Hagin)
Re: Array - how do I found out how many elements are in (Neil Kandalgaonkar)
Re: calling Java methods / classes <tye@metronet.com>
Re: cgi and back button? <david@jeepster.co.uk>
Re: CGI-to-NT service communication..... <gtreece@vhbtech.com>
Re: closing read-only filehandles [was: Read a file int <flavell@mail.cern.ch>
commands for win with perl <qvyht@iobox.fi>
Re: commands for win with perl (Anno Siegel)
Re: commands for win with perl <qvyht@iobox.fi>
Re: convert string to real data. <ecmorgan@lucent.com>
Re: How do you pass objects to a subroutine? <j_f9NOj_SPAM@yahoo.com.invalid>
Re: How do you pass objects to a subroutine? (Bernard El-Hagin)
How to limit the size of an input field <harris@rock.upnaway.com>
Re: How to limit the size of an input field <noemail@noemail.com>
How to read file line by line! <psi@nospam.mikrolog.fi>
Re: How to read file line by line! <foo@bar.va>
Re: How to read file line by line! <psi@nospam.mikrolog.fi>
Re: NEW: AI::NeuralNetwork - idea, comments <iltzu@sci.invalid>
Re: NEWBIE QUESTION !!!!! <bart.lateur@skynet.be>
Newcomer question on Multithreading In Active Perl MSWi <alexei@lisitsa.botik.ru>
Re: Open Off-Server-File (Anno Siegel)
Perl RTE ? <james@goodwill.globalnet.co.uk>
Re: perl/ftp/iis help needed <sturdevr@yahoo.com>
perlcc question <james@goodwill.globalnet.co.uk>
piping output stops suddenly <juha.kiviluoma@vtt.fi>
Problem with reading values out of an ascii file <buggerm@de.ibm.com>
Re: Problem with reading values out of an ascii file <foo@bar.va>
Re: Problem with reading values out of an ascii file (Bernard El-Hagin)
Re: Problem with reading values out of an ascii file (Bernard El-Hagin)
Re: Problem with reading values out of an ascii file <buggerm@de.ibm.com>
Re: Problem with reading values out of an ascii file (Anno Siegel)
Re: Sign Up Script <mrclyde@bolomail.dyn.dhs.org>
Re: Sign Up Script <samara_biz@hotmail.com>
Re: Sorting multidimensional arrays <yfan1@nortelnetworks.com>
Re: Sorting multidimensional arrays <yfan1@nortelnetworks.com>
Re: Suggestion for syntax change <bart.lateur@skynet.be>
Re: Where on the net can I <bart.lateur@skynet.be>
Zlib, uncompress returning empty string? <twan@888nlweb.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 19 Jul 2000 13:33:19 +0200
From: Neil 'Jed' Jedrzejewski <jed@speedfreak.com>
Subject: Array - how do I found out how many elements are in one?
Message-Id: <cZF1OfJ6CEaZ=vvczbCrINAxMVaD@4ax.com>
Hej All,
Is there something similar to lbound or ubound in Perl?
I have tokenized an delimited string into an array but as the string
is variable length, the total number of elements in the array is non
constant.
How can I get the total number of elements in an array?
- Jed
------------------------------
Date: Wed, 19 Jul 2000 11:46:38 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Array - how do I found out how many elements are in one?
Message-Id: <slrn8nb508.6r.bernard.el-hagin@gdndev25.lido-tech>
Neil 'Jed' Jedrzejewski <jed@speedfreak.com> wrote:
>Hej All,
>
>Is there something similar to lbound or ubound in Perl?
>
>I have tokenized an delimited string into an array but as the string
>is variable length, the total number of elements in the array is non
>constant.
>
>How can I get the total number of elements in an array?
perldoc perldata
Bernard
--
perl -e '${qq=\x22=}=qq=\053=;$_="BeJUST_ANOTHERnaPERL_HACKERd\n";
${qq=\x2c=}=qq=\x72=;print split /[AC-Z_]$"/;'
------------------------------
Date: Wed, 19 Jul 2000 11:50:59 GMT
From: neil@brevity.org (Neil Kandalgaonkar)
Subject: Re: Array - how do I found out how many elements are in one?
Message-Id: <8l44a6$2j2$1@localhost.localdomain>
In article <cZF1OfJ6CEaZ=vvczbCrINAxMVaD@4ax.com>,
Neil 'Jed' Jedrzejewski <jed@speedfreak.com> wrote:
>How can I get the total number of elements in an array?
1. @array in scalar context. e.g.
$length = @array;
if (@array < 9) { ... }
print scalar @array;
2. $#array gives the subscript of the last element.
See perldoc perldata. Search for 'length' and it pops right up.
--
Neil Kandalgaonkar <neil@brevity.org>
------------------------------
Date: 18 Jul 2000 23:16:09 -0500
From: Tye McQueen <tye@metronet.com>
Subject: Re: calling Java methods / classes
Message-Id: <8l3a29$2ne@beanix.metronet.com>
S P Arif Sahari Wibowo <arifsaha@yahoo.com> writes:
)
) Using JPL will require me to recompile perl - since its dynamic library
) requirement,
I don't know JPL but most uses of dynamic libraries with Perl
don't require recompiling or even relinking Perl. That is part of
the point of dynamic libraries. You will probably have to compile
the JPL extension in order to install it.
) and that may cause perl run slower. Am I right?
If JPL uses dynamic libraries like most Perl extensions, then it
makes absolutely no difference to Perl or scripts unless they
request that the JPL extension be loaded, usually via C<use>.
Perhaps JPL is not at all like most extensions and so this
doesn't apply, but no one else more knowledgeable of JPL has
publicly responded so I hoped this info might be helpful.
--
Tye McQueen Nothing is obvious unless you are overlooking something
http://www.metronet.com/~tye/ (scripts, links, nothing fancy)
------------------------------
Date: Wed, 19 Jul 2000 12:07:46 +0100
From: David Kitchen <david@jeepster.co.uk>
Subject: Re: cgi and back button?
Message-Id: <39758C02.F73A3EE4@jeepster.co.uk>
> > Is there a quick or easy way to configure a perl script to trigger the
> > back
> > button on your browser?
> >
> > I have a script that you can search on a query then update some the
> > records,
> > the problems after the submit it returns to a default view which is a
> > brosable view of all records, I want it to return to the current query
> > search.
> >
> > Please help :)
> >
> >
how about using echoing the server variables? just echo the referer and point back
to that ;)
the only problem i have had with this is that some scripts happily forget the
referer along the way, but create a hidden field and pass it as a variable to the
output and it should be ok i guess.
it's not a true way to trigger the back button, but if you do want to keep it
server side, it should be fine.
david
------------------------------
Date: Wed, 19 Jul 2000 07:26:17 -0500
From: Greg Treece <gtreece@vhbtech.com>
Subject: Re: CGI-to-NT service communication.....
Message-Id: <930271EDB1A3A4EA.E19E20C99A37B1F2.1CD2C90B61241E29@lp.airnews.net>
Greg Treece wrote:
> I am trying to feed some information from a cgi program (Apache) to an
> NT service via a socket and
> my perl script cannot open its socket connection. This works when run
> from the command
> line. Are there interprocess security settings somewhere to make this
> happen?
Sorry for the wasted bandwidth - turns out I had a typo in my $SvcHost.
------------------------------
Date: Wed, 19 Jul 2000 11:58:06 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: closing read-only filehandles [was: Read a file into a hash ?]
Message-Id: <Pine.GHP.4.21.0007191155060.11998-100000@hpplus03.cern.ch>
On 19 Jul 2000, Jonathan Stowe wrote:
> >> I don't remember the subject; I do remember suggesting the solution --
> >> close the file before unlinking or renaming it!
> >
> > But on systems that implement file locking, this is going to unlock
> > the file - and thus let others get at it in the window before it's
> > actually unlinked/renamed.
>
> I think we are talking about those OS where it is not possible to rename
> or unlink a file that is open in any mode whatsoever - no names no aspertions.
Sure. Looks like we're back to that recently-discussed semaphore-file
solution, in the kind of context where both locking and renaming/
unlinking are needed, no?
------------------------------
Date: Wed, 19 Jul 2000 12:48:54 GMT
From: Hessu <qvyht@iobox.fi>
Subject: commands for win with perl
Message-Id: <3975A3F7.6BD0D65@iobox.fi>
I am using win9x. I want unix and maybe other commands
(like grep etc)
for my use. They should be written in perl.
Do you know where I can find these kind of scripts?
------------------------------
Date: 19 Jul 2000 12:57:39 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: commands for win with perl
Message-Id: <8l48k3$jvg$1@lublin.zrz.tu-berlin.de>
Hessu <qvyht@iobox.fi> wrote in comp.lang.perl.misc:
>I am using win9x. I want unix and maybe other commands
>(like grep etc)
>for my use. They should be written in perl.
>Do you know where I can find these kind of scripts?
Take a look at the Perl Power Tools project at http://language.perl.com/ppt/
Anno
--
"Its not bad design, its a cgi script!"
------------------------------
Date: Wed, 19 Jul 2000 12:59:24 GMT
From: Hessu <qvyht@iobox.fi>
Subject: Re: commands for win with perl
Message-Id: <3975A66E.58F10711@iobox.fi>
Anno Siegel wrote:
>
> Hessu <qvyht@iobox.fi> wrote in comp.lang.perl.misc:
> >I am using win9x. I want unix and maybe other commands
> >(like grep etc)
> >for my use. They should be written in perl.
> >Do you know where I can find these kind of scripts?
>
> Take a look at the Perl Power Tools project at http://language.perl.com/ppt/
>
> Anno
> --
> "Its not bad design, its a cgi script!"
thanx
------------------------------
Date: Wed, 19 Jul 2000 08:08:04 -0400
From: Edward C Morgan <ecmorgan@lucent.com>
Subject: Re: convert string to real data.
Message-Id: <39759A24.FF04FA87@lucent.com>
That's initially what I ended up doing. What I was doing was inheriting
IO::File
into another class so that I could keep a record of all the files I had opened
so I could close them all if I got a signal like INT. After closing them, I
could then delete them. (Solaris 2.6 wouldn't always allow me to remove files
that weren't closed.)
I like the fact that I wasn't keeping a reference to the file so that I could
use the DESTROY routine to close them when they went out of scope. Keeping
them only as keys to a has still allowed me to do this, but if I kept them in
arrays or the value of a hash didn't.
I ultimately used the POSIX module to find out how many file handles I was
allowed and iterated over them all (excluding STDIN, STDOUT, and STDERR) and
closed them.
Thanks for your message. I suspected I couldn't do it after I realized I was
storing strings as keys.
Ala Qumsieh wrote:
>
> Edward C Morgan <ecmorgan@lucent.com> writes:
>
> > I have the following code:
> >
> > %map=();
> > $fh=IO::File->new("> foo");
> > $map{$fh}=1;
> >
> > The map now has a string "IO::File::GLOB(0x1234)"
> > How do I convert this string back into the object?
>
> You can't. Hash keys are converted to strings automatically. So, using a
> blessed reference as a key will actually generate a key string that
> happens to look like "IO::File::GLOB(0x1234)", but has no relation to
> the reference what so ever.
>
> My workaround is usually:
>
> $map{$fh} = $fh;
>
> and then use the value, which is a scalar, and can hold references.
>
> --Ala
--
=========================================
Edward C. Morgan
Email: ecmorgan@lucent.com
Phone: (610) 712-3435
Do not boast about tomorrow, For you
do not know what a day may bring forth.
=========================================
------------------------------
Date: Wed, 19 Jul 2000 05:15:24 -0700
From: Frederic <j_f9NOj_SPAM@yahoo.com.invalid>
Subject: Re: How do you pass objects to a subroutine?
Message-Id: <29639a84.79ebcdb9@usw-ex0102-014.remarq.com>
One more thing. How do I pass other parameters as well? I need
to pass a few scalars to the subroutine along with the object,
like this:
process($obj, $var1, $var2);
I've tried to set them up in various ways in the subroutine, but
can't figure out the right way to do it:
sub process {
my(($obj = shift), $var1, $var2) = @_;
or: my($obj, $var1, $var2) = shift;
or: my ($obj, $var1, $var2) = @_;
$obj = shift;
None of these work correctly.
Greetings,
Frederic
Samay <samay1NOsaSPAM@hotmail.com.invalid> wrote:
>
>use Obj
>my $obj = Obj->new("arguments");
>process($obj);
>
>
>sub process {
> my $obj = shift;
> $obj->method();
> do whatever..
>}
-----------------------------------------------------------
Got questions? Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com
------------------------------
Date: Wed, 19 Jul 2000 13:00:23 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: How do you pass objects to a subroutine?
Message-Id: <slrn8nb9ah.6r.bernard.el-hagin@gdndev25.lido-tech>
Frederic <j_f9NOj_SPAM@yahoo.com.invalid> wrote:
>One more thing. How do I pass other parameters as well? I need
>to pass a few scalars to the subroutine along with the object,
>like this:
>
> process($obj, $var1, $var2);
The three parameters are in @_ so:
$_[0] == $obj;
$_[1] == $var1;
$_[2] == $var2;
It's just like any other array so you can shift @_ in a while loop:
sub a{
while ($a = shift){
#do something funky with $a
}
}
or in a foreach loop:
sub a{
foreach $a (@_){
#do the wild thang with $a
}
}
Bernard
--
perl -e '${qq=\x22=}=qq=\053=;$_="BeJUST_ANOTHERnaPERL_HACKERd\n";
${qq=\x2c=}=qq=\x72=;print split /[AC-Z_]$"/;'
------------------------------
Date: Wed, 19 Jul 2000 20:12:40 +0800
From: "Harry" <harris@rock.upnaway.com>
Subject: How to limit the size of an input field
Message-Id: <39759a74@usenet.per.paradox.net.au>
in a post form is there a way to get a script to give an error msg if the
entry is to long
------------------------------
Date: Wed, 19 Jul 2000 08:54:57 -0400
From: Young <noemail@noemail.com>
Subject: Re: How to limit the size of an input field
Message-Id: <3975A521.274BF060@noemail.com>
In a HTML text box, you can use the MAXLENGTH property. You can't type beyond
the specified number of characters.
Example: <INPUT TYPE="text" NAME="variablename" MAXLENGTH=15>
Harry wrote:
> in a post form is there a way to get a script to give an error msg if the
> entry is to long
------------------------------
Date: Wed, 19 Jul 2000 10:42:29 GMT
From: "Pekka Siiskonen" <psi@nospam.mikrolog.fi>
Subject: How to read file line by line!
Message-Id: <pCfd5.104$aQ4.5415@read2.inet.fi>
Usually files are read like:
-------
open HANDLE, "filename" or die "filename";
while (<HANDLE>){
$foo=$_; # or something...
}
close (HANDLE);
-------
But what if I need to open two or more files at the same time and read them
(large files) row by row in phase with each other? I cannot put the file
handles in while as I cannot reach the values, and opening the files with
different handles and reading with:
$bar=<FILEHANDLE2>;
won't return a thing! I'm not keen on loading all of the two or more files
in ann array to search with indexes as the amount of data is large! I'm
using perl 5.00502 in NT.
Pekka Siiskonen
------------------------------
Date: Wed, 19 Jul 2000 12:57:16 +0200
From: Marco Natoni <foo@bar.va>
Subject: Re: How to read file line by line!
Message-Id: <3975898C.C9709429@bar.va>
Pekka,
Pekka Siiskonen wrote:
> Usually files are read like:
> -------
> open HANDLE, "filename" or die "filename";
> while (<HANDLE>){
> $foo=$_; # or something...
> }
> close (HANDLE);
> -------
> But what if I need to open two or more files at the same time and
> read them (large files) row by row in phase with each other? I
> cannot put the file handles in while as I cannot reach the values,
> and opening the files with different handles and reading with:
> $bar=<FILEHANDLE2>;
>
> won't return a thing! I'm not keen on loading all of the two or
> more files in ann array to search with indexes as the amount of
> data is large!
It is very likely that I have not understood your question, but...
<code>
open FH1,'<filename1' or die "filename1: $!";
open FH2,'<filename2' or die "filename2: $!";
while (($foo=<FH1>) and ($bar=<FH2>)) {
# do something with either the files
}
if (!eof FH1) {
while ($foo=<FH1>) {
# do something with the remaining part of
# the first file
}
}
if (!eof FH2) {
while ($bar=<FH2>) {
# do something with the remaining part of
# the second file
}
}
close FH1;
close FH2;
</code>
Best regards,
Marco
------------------------------
Date: Wed, 19 Jul 2000 11:02:56 GMT
From: "Pekka Siiskonen" <psi@nospam.mikrolog.fi>
Subject: Re: How to read file line by line!
Message-Id: <AVfd5.106$aQ4.5785@read2.inet.fi>
Yes you got it right! Must try at once!
pekka
"Marco Natoni" <foo@bar.va> wrote in message
news:3975898C.C9709429@bar.va...
> Pekka,
>
> Pekka Siiskonen wrote:
> > Usually files are read like:
> > -------
> > open HANDLE, "filename" or die "filename";
> > while (<HANDLE>){
> > $foo=$_; # or something...
> > }
> > close (HANDLE);
> > -------
> > But what if I need to open two or more files at the same time and
> > read them (large files) row by row in phase with each other? I
> > cannot put the file handles in while as I cannot reach the values,
> > and opening the files with different handles and reading with:
> > $bar=<FILEHANDLE2>;
> >
> > won't return a thing! I'm not keen on loading all of the two or
> > more files in ann array to search with indexes as the amount of
> > data is large!
>
> It is very likely that I have not understood your question, but...
>
> <code>
> open FH1,'<filename1' or die "filename1: $!";
> open FH2,'<filename2' or die "filename2: $!";
>
> while (($foo=<FH1>) and ($bar=<FH2>)) {
> # do something with either the files
> }
>
> if (!eof FH1) {
>
> while ($foo=<FH1>) {
> # do something with the remaining part of
> # the first file
> }
>
> }
>
> if (!eof FH2) {
>
> while ($bar=<FH2>) {
> # do something with the remaining part of
> # the second file
> }
>
> }
>
> close FH1;
> close FH2;
> </code>
>
>
> Best regards,
> Marco
------------------------------
Date: 19 Jul 2000 10:38:01 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: NEW: AI::NeuralNetwork - idea, comments
Message-Id: <964002916.12851@itz.pp.sci.fi>
In article <8l3moa$7b2$1@nnrp1.deja.com>, peterhi@my-deja.com wrote:
>AI::NeuralNetwork::BackProp perhaps and then we can extend the base name
That's not going to win a golf contest. Surely something shorter
would work just as well..
AI::NeuralNet::BackProp?
AI::Neural::BackProp?
AI::Neural::BP?
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"The screwdriver *is* the portable method." -- Abigail
Please ignore Godzilla and its pseudonyms - do not feed the troll.
------------------------------
Date: Wed, 19 Jul 2000 11:25:11 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: NEWBIE QUESTION !!!!!
Message-Id: <ej2bnscvbo50pmv8j1a5n3vi2fibib5imf@4ax.com>
felix.gourdeau@videotron.ca.bbs@openbazaar.net (Félix Gourdeau) wrote:
>i have this string :
>
> $sun =3D <<'FF';
>
> aaaaa [
> bbbbbb
> bbb
> ]
> aaaaaa
> [
> bbbbbbbb
> bbb
> ]
>
> FF
>
>and i want to delete all newline \n characters inside all brackets
>[...]. Can someone help me ???
Let's see...
while(<>) {
if(/\[/ .. (my $last = /\]/) {
chomp unless $last;
}
print;
}
-->
aaaaa [bbbbbbbbb]
aaaaaa
[bbbbbbbbbbb]
Oops. I've read the data from a file, not from a string. Oh well..
{
local $/ = "\n";
$sun =~ s!(.*\n?)!
local $_ = $1;
if(/\[/ .. (my $last = /\]/)) {
chomp unless $last;
}
$_;
!ge;
}
print $sun;
--
Bart.
------------------------------
Date: Wed, 19 Jul 2000 15:54:00 +0400
From: Alexei P Lisitsa <alexei@lisitsa.botik.ru>
Subject: Newcomer question on Multithreading In Active Perl MSWin32
Message-Id: <397596D7.B8B7BA11@lisitsa.botik.ru>
Hello,
could somebody give me a hint, what is the problem with threads in the
following:
I run "perl ttt.pl" where ttt.pl is as follows( simple example from a
tutorial on threads):
---------------------------------------------------------------------------------
use Thread;
$thr = new Thread \&sub1;
sub sub1 {
print "In the thread\n";
}
------------------------------------------------------------------------------------
I've got a diganostic: "No threads in this perl at ttt.pl line 2".
I use Win98.
"perl -V" reported :
... perl5(revision 5 version 6 subversion 0)
Platform: osname =MSWin32 osvers = 4.0, Archname
=MSwin32-x86-multithread
....
Thanks,
Alexei Lisitsa
------------------------------
Date: 19 Jul 2000 10:20:56 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Open Off-Server-File
Message-Id: <8l3ve8$jr0$1@lublin.zrz.tu-berlin.de>
Phoebus <phoe6us@my-deja.com> wrote in comp.lang.perl.misc:
>wow thanx for getting back to me so soon, you would think perl/cgi
>would have an easier way to do this...it seems i have to install the
Man, I feel old. Just too goddamn old...
Anno
--
Its not bad design, its a cgi script.
------------------------------
Date: Wed, 19 Jul 2000 09:59:10 +0100
From: "James Goodwill" <james@goodwill.globalnet.co.uk>
Subject: Perl RTE ?
Message-Id: <8l3vpu$bpb$1@gxsn.com>
Hi,
I've developed an application written in Perl (on AIX), and wish to
implement it on other AIX servers without having to install the full Perl
software (about 32 Mb on AIX).
How can I install just the bits I need to get Perl up-and-running, i.e. a
runtime environment? Or am I looking at compiling the Perl code?
Any suggestions ?
James G.
------------------------------
Date: Wed, 19 Jul 2000 07:31:38 -0400
From: "BobS" <sturdevr@yahoo.com>
Subject: Re: perl/ftp/iis help needed
Message-Id: <8l43ha$f7m$1@bob.news.rcn.net>
To close the loop with everyone, apparently IIS had a known bug in the FTP
SIZE command that was fixed by NT SP6a. The problem went away after reload
of SP6a. See MS Knowledge Base article Q182006.
Bob
------------------------------
Date: Wed, 19 Jul 2000 11:38:52 +0100
From: "James Goodwill" <james@goodwill.globalnet.co.uk>
Subject: perlcc question
Message-Id: <8l40fa$knc$1@gxsn.com>
Hi,
I've had a look at perlcc, which is located down /usr/local/bin.
Can I use this to compile a perl script, like a "Hello World" program?
#!/usr/bin/perl
print "Hello World\n";
If so, what do I need to do? I have Perl 5.6.0 installed (stable version).
Thanks.
------------------------------
Date: Wed, 19 Jul 2000 13:57:04 +0300
From: Juha Kiviluoma <juha.kiviluoma@vtt.fi>
Subject: piping output stops suddenly
Message-Id: <39758980.F019F9E0@vtt.fi>
Hi folks.
I've got a problem with ActiveState Perl 5.6 build 616 and gnuplot 3.7.1
running in Win NT. My piping output stops after several lines of output
into a gnuplot pipe. It stops in the middle of line without any apparent
reason even though I flush the buffer often. My example code looks like
this:
#!/bin/perl -w
open GNU, "| pgnuplot" or die "Can't open gnuplot: $!";
for my $x (0 .. 1000) {
print GNU "set title '$x'\n";
select((select(GNU), $| = 1)[0]); #flushing the output
}
close GNU;
Does the buffer overflow even though I flush it? The code outputs 134
lines into gnuplot and then stops. It leaves gnuplot open although it
should close it.
regards,
Juha Kiviluoma
------------------------------
Date: Wed, 19 Jul 2000 14:18:06 +0200
From: Sven <buggerm@de.ibm.com>
Subject: Problem with reading values out of an ascii file
Message-Id: <39759C7E.A5091281@de.ibm.com>
Hi !
I want to extract a formula out of a ascii file end evaluate it:
something like this:
#
saddwefwef fwefewrrr 3+4 fsdre wfefa
#
i want to extrakt 3+4 into a variable and print out the result: 7
Thanks for the help !!!
------------------------------
Date: Wed, 19 Jul 2000 14:41:15 +0200
From: Marco Natoni <foo@bar.va>
Subject: Re: Problem with reading values out of an ascii file
Message-Id: <3975A1EB.57C7BF9D@bar.va>
Sven,
Sven wrote:
> I want to extract a formula out of a ascii file end evaluate
> it: something like this:
> #
> saddwefwef fwefewrrr 3+4 fsdre wfefa
> #
> i want to extrakt 3+4 into a variable and print out the result: 7
You must know the pattern of the formula or how to recognize it in the
given text. Then, you can use the /eval/ subroutine.
perldoc perlre
perldoc -f eval
Best regards,
Marco
------------------------------
Date: Wed, 19 Jul 2000 12:49:26 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Problem with reading values out of an ascii file
Message-Id: <slrn8nb8m0.6r.bernard.el-hagin@gdndev25.lido-tech>
On Wed, 19 Jul 2000 14:18:06 +0200, Sven <buggerm@de.ibm.com> wrote:
>Hi !
>I want to extract a formula out of a ascii file end evaluate it:
>something like this:
>#
>saddwefwef fwefewrrr 3+4 fsdre wfefa
>#
>i want to extrakt 3+4 into a variable and print out the result: 7
$_ = "saddwefwef fwefewrrr 3+4 fsdre wfefa";
($a) = $_ =~ m/^D*(\d+\s*.\s*\d+)\D*$/;
print $a; #3+4
print (eval $a); #7
This will do for your example, but without clear criteria I can't
provide a more general solution.
>Thanks for the help !!!
You're welcome.
Bernard
--
perl -e '${qq=\x22=}=qq=\053=;$_="BeJUST_ANOTHERnaPERL_HACKERd\n";
${qq=\x2c=}=qq=\x72=;print split /[AC-Z_]$"/;'
------------------------------
Date: Wed, 19 Jul 2000 12:50:52 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Problem with reading values out of an ascii file
Message-Id: <slrn8nb8om.6r.bernard.el-hagin@gdndev25.lido-tech>
On Wed, 19 Jul 2000 12:49:26 GMT, Bernard El-Hagin
<bernard.el-hagin@lido-tech.net> wrote:
>On Wed, 19 Jul 2000 14:18:06 +0200, Sven <buggerm@de.ibm.com> wrote:
>>Hi !
>>I want to extract a formula out of a ascii file end evaluate it:
>>something like this:
>>#
>>saddwefwef fwefewrrr 3+4 fsdre wfefa
>>#
>>i want to extrakt 3+4 into a variable and print out the result: 7
>
>$_ = "saddwefwef fwefewrrr 3+4 fsdre wfefa";
>($a) = $_ =~ m/^D*(\d+\s*.\s*\d+)\D*$/;
^^^
Typo. That "D" should be "\D".
Bernard
--
perl -e '${qq=\x22=}=qq=\053=;$_="BeJUST_ANOTHERnaPERL_HACKERd\n";
${qq=\x2c=}=qq=\x72=;print split /[AC-Z_]$"/;'
------------------------------
Date: Wed, 19 Jul 2000 14:52:39 +0200
From: Sven <buggerm@de.ibm.com>
Subject: Re: Problem with reading values out of an ascii file
Message-Id: <3975A497.6FC4C4E1@de.ibm.com>
Marco Natoni wrote:
> Sven,
>
> Sven wrote:
> > I want to extract a formula out of a ascii file end evaluate
> > it: something like this:
> > #
> > saddwefwef fwefewrrr 3+4 fsdre wfefa
> > #
> > i want to extrakt 3+4 into a variable and print out the result: 7
>
> You must know the pattern of the formula or how to recognize it in the
> given text. Then, you can use the /eval/ subroutine.
>
> perldoc perlre
> perldoc -f eval
>
> Best regards,
> Marco
Thanks for the answer
lets say the formula begins with a keyword like %3+4%
i tried eval and it works fine for a variable like $var=3+4;
but how can i take it out of the string ?
------------------------------
Date: 19 Jul 2000 13:01:56 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Problem with reading values out of an ascii file
Message-Id: <8l48s4$k1m$1@lublin.zrz.tu-berlin.de>
Sven <buggerm@de.ibm.com> wrote in comp.lang.perl.misc:
>Marco Natoni wrote:
>
>> Sven,
>>
>> Sven wrote:
>> > I want to extract a formula out of a ascii file end evaluate
>> > it: something like this:
>> > #
>> > saddwefwef fwefewrrr 3+4 fsdre wfefa
>> > #
>> > i want to extrakt 3+4 into a variable and print out the result: 7
>>
>> You must know the pattern of the formula or how to recognize it in the
>> given text. Then, you can use the /eval/ subroutine.
>>
>> perldoc perlre
>> perldoc -f eval
>>
>> Best regards,
>> Marco
>
>Thanks for the answer
>lets say the formula begins with a keyword like %3+4%
>i tried eval and it works fine for a variable like $var=3+4;
>but how can i take it out of the string ?
Well, that's what Marcus was driving at with his remark about having to
"know the pattern" of the formula. Only you can tell what sorts of
formulas can appear and how they can be separated from the background noise.
A single, made-up example just isn't enough to tell.
Anno
--
"Its not bad design, its a cgi script!"
------------------------------
Date: Wed, 19 Jul 2000 07:52:33 -0400
From: "MrClyde" <mrclyde@bolomail.dyn.dhs.org>
Subject: Re: Sign Up Script
Message-Id: <8l454c$10uc$1@news.gate.net>
Thanks for your gracious reply. That's exactly what I have been trying to do
for two weeks.
"Abigail" <abigail@delanet.com> wrote in message
news:slrn8nap38.3do.abigail@alexandra.delanet.com...
> MrClyde (mrclyde@bolomail.dyn.dhs.org) wrote on MMDXIV September MCMXCIII
> in <URL:news:8l3dhj$thq$1@news.gate.net>:
> )) Does anyone know where I can get a script to work with an account sign
up
> )) forms page? I need something that determines if the client's requested
> )) account name is available and if 2 password enteries they are required
to
> )) fill in are identical prior to the form being processed.
>
>
> Hire a programmer.
>
>
>
> Abigail
> --
>
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47
]
>
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W
]
>
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^
V
> %$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: Wed, 19 Jul 2000 08:14:50 -0400
From: "Alex T." <samara_biz@hotmail.com>
Subject: Re: Sign Up Script
Message-Id: <39759BBA.692AB269@hotmail.com>
What he was saying is that if you go to, say, www.yahoo.com and type "sign up
script" in the search box, it will give you a huge number of links to the
web-sites where you can get the script that you need. Password protection/Sign
up scripts are pretty common.
It's a different case if you need a script to with in IIS/Windows NT. There's
not that many of them, but in that case you should have said what platform
you're using.
Alex
MrClyde wrote:
> Thanks for your gracious reply. That's exactly what I have been trying to do
> for two weeks.
>
> "Abigail" <abigail@delanet.com> wrote in message
> news:slrn8nap38.3do.abigail@alexandra.delanet.com...
> > MrClyde (mrclyde@bolomail.dyn.dhs.org) wrote on MMDXIV September MCMXCIII
> > in <URL:news:8l3dhj$thq$1@news.gate.net>:
> > )) Does anyone know where I can get a script to work with an account sign
> up
> > )) forms page? I need something that determines if the client's requested
> > )) account name is available and if 2 password enteries they are required
> to
> > )) fill in are identical prior to the form being processed.
> >
> >
> > Hire a programmer.
> >
> >
> >
> > Abigail
> > --
> >
> perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47
> ]
> >
> .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W
> ]
> >
> .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^
> V
> > %$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: Wed, 19 Jul 2000 08:42:29 -0400
From: Young <yfan1@nortelnetworks.com>
Subject: Re: Sorting multidimensional arrays
Message-Id: <3975A235.ED0A1475@nortelnetworks.com>
Thanks a lot, Cameron --it worked!
Cameron Kennedy wrote:
> In article <397482BC.1FB0D37A@nortelnetworks.com>, Young
> <no_email@no_email.com> wrote:
>
> > Hi,
> >
> > Can you tell me how to sort a multidimensional array?
> >
> > I have an array @rows, with $rows[$i][0] being a number, and
> > $rows[$i][1] being the string I want to sort by (ascending).
> >
>
> @sorted=sort { $a->[1] cmp $b->[1]}@rows;
>
> Cameron
------------------------------
Date: Wed, 19 Jul 2000 08:42:47 -0400
From: Young <yfan1@nortelnetworks.com>
Subject: Re: Sorting multidimensional arrays
Message-Id: <3975A247.B6F03FEA@nortelnetworks.com>
Thanks, Makarand.
Makarand Kulkarni wrote:
> Young wrote:
> >
> > Hi,
> >
> > Can you tell me how to sort a multidimensional array?
> > How do I do this?
>
> check the Schwartzian transform
> http://www.5sigma.com/perl/schwtr.html
> for more sorting power.
> -
------------------------------
Date: Wed, 19 Jul 2000 11:39:57 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Suggestion for syntax change
Message-Id: <dq4bnsg43npfulr7m85mmev3l0qvlreuov@4ax.com>
jason wrote:
>would there be many (any?)
>situations where you'd be interested in going from index (x) to index
>(Z-y) (where Z represents the length of the unknown LIST) ??
Try skipping the first 2 items.
@rest = @somelist[2 .. -1];
If you're talking about dropping a few items at the end: indeed, that
would be rare.
--
Bart.
------------------------------
Date: Wed, 19 Jul 2000 11:52:02 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Where on the net can I
Message-Id: <ja5bnskgcj3nmt5d72ujgrjqer7ainisib@4ax.com>
Hans Kvalheim wrote:
>Where on the net can I...
>find more info about PERL?
It's "perl" for the exectuable, and "Perl" for the language.
<http://www.perl.com/>
<http://use.perl.org/>
<http://www.perlmonth.com/>
<http://www.cpan.org/>
<http://www.plover.com/~mjd/perl/>
Neh. There's a few.
--
Bart.
------------------------------
Date: Wed, 19 Jul 2000 14:25:36 +0200
From: Twan Kogels <twan@888nlweb.com>
Subject: Zlib, uncompress returning empty string?
Message-Id: <ot6bnskc4ed0nu5k5c601odn87sqek336j@4ax.com>
Hi!
I have a little program with uncompression a string. I receive this
string from a POST event, like :
#get the data
my $res=$q->param('data');
#uncompress the data
my $data=uncompress($res);
$res contains the POST data, but when i call the uncompress()
function, and look at $data, then $data is totally empty.
I'm using the cgi.pm module with the Compress-Zlib-1.08 from cpan. The
data is compressed with the CompressBuf() function from the zlib.dll
in windows.
Am i doing something wrong?
Thanks for your help,
Twan
MyTodo: http://www.twansoft.com/todo
------------------------------
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 3745
**************************************