[18258] in Perl-Users-Digest
Perl-Users Digest, Issue: 426 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 6 09:05:38 2001
Date: Tue, 6 Mar 2001 06:05:10 -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: <983887509-v10-i426@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 6 Mar 2001 Volume: 10 Number: 426
Today's topics:
Bug in "perldoc -f our" (was: use strict (vars, etc.)) nobull@mail.com
Re: checkbox problem <gi59@dial.pipex.com>
Re: checkbox problem nobull@mail.com
Re: creating dos exectable from perl script <carvdawg@patriot.net>
Re: different $/ for different filehandle? <bart.lateur@skynet.be>
Re: flock and close with empty read strangeness (Martien Verbruggen)
Re: flock and close with empty read strangeness (Martien Verbruggen)
Re: flock and close with empty read strangeness (Ilya Zakharevich)
Re: flock and close with empty read strangeness <bart.lateur@skynet.be>
Re: flock and close with empty read strangeness <bart.lateur@skynet.be>
Re: flock and close with empty read strangeness (Abigail)
Re: Grokking map and grep <pne-news-20010306@newton.digitalspace.net>
Re: Grokking map and grep (Anno Siegel)
Insert value into another window <s.gatzhammer@novathink3.de>
Re: Insert value into another window (Martien Verbruggen)
Re: Is Perl right for me? (Martien Verbruggen)
PHP Help me please !!! <calimhero@galbord.com>
Re: PHP Help me please !!! <peter.s@tjgroup.dk>
Re: Regex question (newbie) <godzilla@stomp.stomp.tokyo>
Re: RFC: FAQ3 update -- Using less memory (Ilya Zakharevich)
Re: statement for(list); (Martien Verbruggen)
Re: statement for(list); (Ilya Zakharevich)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 06 Mar 2001 12:31:20 +0000
From: nobull@mail.com
Subject: Bug in "perldoc -f our" (was: use strict (vars, etc.))
Message-Id: <u9hf17m63r.fsf_-_@wcl-l.bham.ac.uk>
Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov> writes:
> our EXPR
> An "our" declares the listed variables to be valid globals
> within the enclosing block, file, or "eval". That is, it has
> the same scoping rules as a "my" declaration, but does not
> create a local variable. If more than one value is listed,
> the list must be placed in parentheses. The "our" declaration
> has no semantic effect unless "use strict vars" is in effect,
> in which case it lets you use the declared global variable
> without qualifying it with a package name. (But only within
> the lexical scope of the "our" declaration. In this it
> differs from "use vars", which is package scoped.)
Spot the deliberate mistake?
$ perl -e '$f=1; my $f=2; print $f'
2
$ perl -e '$f=1; my $f=2; our $f; print $f'
1
I think I'd call that a semantic effect.
Corrected version:
our EXPR
An "our" declares the listed variables to be valid globals
within the enclosing block, file, or "eval". That is, it has
the same scoping rules as a "my" declaration and will hide
variables of the same name previously declared with "my". It
does not create local variables. If more than one value is
listed, the list must be placed in parentheses. The "our"
declaration lets you use the declared global variable without
qualifying it with a package name even if "use strict vars"
is in effect. (But only within the lexical scope of the
"our" declaration. In this it differs from "use vars", which
is package scoped.)
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 6 Mar 2001 12:08:57 -0000
From: "Alan Hood" <gi59@dial.pipex.com>
Subject: Re: checkbox problem
Message-Id: <982i9t$k3b$1@lure.pipex.net>
Chris
Your psychic powers were bang on.
I am fairly new to Perl and am using the CGI.pm param method to bring in the
values.
Can you tell me the best way to check that the values exist?
Many thanks for the reply (I'll try to be a bit more specific next time !!!)
Alan Hood
cdh <cdh@ala.net> wrote in message news:3AA2F523.526B5600@ala.net...
> Alan Hood wrote:
>
> > I seem to have a problem passing a check box value to a CGI script.
> >
> > If the box is NOT checked then the script returns an error.
> >
> > If it is all seems OK.
> >
>
> You really should include relevant details when you are asking for help,
> otherwise you just waste peoples time.
>
> Using my psychic powers, I'd guess your problem is that you don't realize
> that when a checkbox is off, no {key}={value} pair is passed, as opposed
> to when it's on it passes {key}=on.
>
> cheers,
> Chris Hickman
>
>
------------------------------
Date: 06 Mar 2001 12:24:52 +0000
From: nobull@mail.com
Subject: Re: checkbox problem
Message-Id: <u9itlnm6ej.fsf@wcl-l.bham.ac.uk>
Jeopardy posting is considered rude - do not do it unless it is your
intension to cause offense.
Jeopardectomy performed...
"Alan Hood" <gi59@dial.pipex.com> writes:.
> cdh <cdh@ala.net> wrote in message news:3AA2F523.526B5600@ala.net...
> > Alan Hood wrote:
> >
> > > I seem to have a problem passing a check box value to a CGI script.
> > >
> > > If the box is NOT checked then the script returns an error.
> >
> > You really should include relevant details when you are asking for help,
> > otherwise you just waste peoples time.
> >
> > Using my psychic powers, I'd guess your problem is that you don't realize
> > that when a checkbox is off, no {key}={value} pair is passed, as opposed
> > to when it's on it passes {key}=on.
>
> Your psychic powers were bang on.
>
> I am fairly new to Perl and am using the CGI.pm param method to bring in the
> values.
>
> Can you tell me the best way to check that the values exist?
defined() will tell you if the result of an expression is defined.
Since checkboxes are boolean, and undefined values doesn't matter in a
boolean context the "best way to check that the values exist" in this
context is probably to avoid putting yourself in a situation where you
care.
> Many thanks for the reply (I'll try to be a bit more specific next time !!!)
Like maybe include some Perl code to give us a clue what you are
doing? Perhaps even a minimal, complete, strict, warning-free script
that manifests the symptoms you are asking about?
We really mean it when we say "relevant details".
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 06 Mar 2001 07:16:33 -0500
From: H C <carvdawg@patriot.net>
Subject: Re: creating dos exectable from perl script
Message-Id: <3AA4D521.E1928414@patriot.net>
Go to http://www.perl2exe.com
The full, licensed version costs a couple of bucks, but it's well worth it.
Carv
C J Sinha wrote:
> Greetings,
> I have written a small perl program which is very useful to my colleagues.
> When someone wants it, I have go over and install perl on their NT machines,
> so that they can run this script.
>
> I understand that it is possible to convert a perl script to a self
> contained .exe file that will run in windows/dos. That way I just pass
> along the .exe file and the do not have to install perl on their machine.
>
> Don't have a clue how to get started. How would I go about doing it? Any
> pointers or examples appreciated.
>
> TIA
> Sanjay
>
> p.s. My skill set of perl is very limited, but I will learn enough to get
> the job done. :-)
------------------------------
Date: Tue, 06 Mar 2001 12:36:06 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: different $/ for different filehandle?
Message-Id: <fjl9at89j6fo90ee52ad5rsmnegknag4tt@4ax.com>
Daniel Heiserer wrote:
>is there away to have different Input-record-separators
>for different Filehandles.
>
>e.g.
>
>open(ip1,"<gf1");
>open(ip2,"<gf2");
>
>$/="\n"; #for gf1
>$/="prompt>"; #for gf2
Yes... but it's probably quite slow.
tie *FH, PrivateInputRecordSeparator, $0, "}\n";
while(<FH>) {
print "<<$_>>\n";
}
package PrivateInputRecordSeparator;
use FileHandle;
use Carp;
sub TIEHANDLE {
my($pkg, $file, $irs) = @_;
my $handle = new FileHandle;
open $handle, $file or croak "Cannot open $file: $!\n";
my %hash = ( FH => $handle, IRS => $irs);
bless \%hash, $pkg;
}
sub READLINE {
my $self = shift;
local $/ = $self->{IRS};
my $fh = $self->{FH};
return <$fh>;
}
--
Bart.
------------------------------
Date: Tue, 6 Mar 2001 21:38:08 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: flock and close with empty read strangeness
Message-Id: <slrn9a9fgg.efn.mgjv@martien.heliotrope.home>
On 6 Mar 2001 10:19:02 GMT,
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
> [A complimentary Cc of this posting was NOT sent to Martien Verbruggen
><mgjv@tradingpost.com.au>],
> who wrote in article <slrn9a9a0s.efn.mgjv@martien.heliotrope.home>:
>> >> Whether you like it or not, that's just how it is.
>> >
>> > ??!!! What makes you think so? Perl uses the model of locking which
>> > is "native" on the architecture it is running.
>>
>> I wasn't talking about what Perl uses internally, but what it exposes to
>> the programmer:
>
> Me too.
>
>> In other words, it's interfaces for opening files,
>> locking them, and closing them. And that precisely mirrors unix system
>> calls, with some C stdio and shell syntax thrown in.
>
> Absolutely not. Perl makes no effort to hide the platform's semantic
> for opening closing and flocking. What you get is what the system does.
That does not diminish in any way that Perl started on Unix, and
therefore it's builtins mimic what happens on a Unix system, and the
system calls that a Unix C process would normally go through to obtain a
lock on a file. Most internal functions in perl neatly match the Unix
system calls.
> If the platform locks on open, so does Perl. If the platform has
> mandatory locks, so does Perl.
Which is what I meant with the last paragraph of my previous post. Athe
one that you cut out :)
Sure, if the OS has mandatory locks, then Perl has mandatory locks. It'd
be almost, if not entirely, impossible not to have this. But Perl still
has the builtins to separately lock.
Perl does not explicitly _attempt_ to lock a file when it gets opened.
On open does what the OS's open does. To make sure that you get a lock,
you flock. Just like on a Unix box. Relying on not having to lock,
because you're on a platform with mandatory locking, gets oyu in trouble
when porting Perl code to platforms where this is necessary.
Sometimes Perl has no choice, and a file gets locked on an open, whether
or not you ask for it, then the file is locked. Sure. But that does not
diminish in any way that Perl's functions reflect the Unix locking
paradigm.
Martien
--
Martien Verbruggen | Since light travels faster than
Interactive Media Division | sound, isn't that why some people
Commercial Dynamics Pty. Ltd. | appear bright until you hear them
NSW, Australia | speak?
------------------------------
Date: Tue, 6 Mar 2001 21:49:18 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: flock and close with empty read strangeness
Message-Id: <slrn9a9g5e.efn.mgjv@martien.heliotrope.home>
On 6 Mar 2001 10:13:56 GMT,
Abigail <abigail@foad.org> wrote:
> Martien Verbruggen (mgjv@tradingpost.com.au) wrote on MMDCCXLIV September
> MCMXCIII in <URL:news:slrn9a9ahj.efn.mgjv@martien.heliotrope.home>:
> ??
> ?? What does that mean? A backup of shared locked reads staling a write?
> ?? And how can a write have a higher priority? ou either have locking or
> ?? you don't. Locking, between equivalent users, would have to be
> ?? implemented on a first-come first-serve basis. If a user has a shared
^^^^^^^^^^^^^^^^^^^^^^
> ?? lock, no one should be given an exclusive lock. That's the whole _point_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> ?? of locking.
> ??
>
> While the latter is true, that doesn't mean it's the same as a first-come,
> first-serve basis. The following is entirely possible, and used in some
> databases:
[snip]
> There is little sense in having processes wait if they could go ahead
> because all they need is a shared lock. OTOH, you don't want exclusive
> lockers to wait forever, so a compromise has to be made.
I didn't mean first-come, first-served as a single queue, I meant it
more as in the first process that aquires the lock determines the type
of lock that is in place, ruling out any precedence between lock types.
It would be a weird system where a request for an exclusive lock would
break a pre-existing read lock (and I'm not talking about opportunistic
locking as implemented on SMB/CIFS, that's a different issue)
I am fully aware of optimisations in lock queueing in (some) databases,
and even some file systems, where shared locks are allowed to proceed,
even though an earlier exclusive lock is queued up (but not active). The
key in the above was the underlined bit. Whenever two mutually exclusive
locks appear, the first one gets the lock, stopping all other mutually
exclusive locks from appearing. Locks that are not mutually exclusive
(shared locks on shared locks) can proceed, within reason.
Martien
--
Martien Verbruggen |
Interactive Media Division | Never hire a poor lawyer. Never buy
Commercial Dynamics Pty. Ltd. | from a rich salesperson.
NSW, Australia |
------------------------------
Date: 6 Mar 2001 11:53:32 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: flock and close with empty read strangeness
Message-Id: <982j3s$ci0$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Anno Siegel
<anno4000@lublin.zrz.tu-berlin.de>],
who wrote in article <982e24$rqt$1@mamenchi.zrz.TU-Berlin.DE>:
> > You mean, you want to turn your filesystem into a database?
>
> If I had to design an OS, I'd give that serious consideration.
You do not need to design an OS to have this. All of the contemporary
OSes already have this up to some extend. At least they get
predictable locking, including locking of regions, and
logarithmic-time directory search. No relational stuff, but for
the simple tie-AnyDBM-like access you can use the plain filesystems API.
Ilya
------------------------------
Date: Tue, 06 Mar 2001 11:58:26 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: flock and close with empty read strangeness
Message-Id: <a2k9at4rtaqkfpbkbir7hjlitqj3846j9v@4ax.com>
Martien Verbruggen wrote:
>In other words, to prevent confusion again, you want an equivalent of
>
>sysopen FH, $name, O_WRONLY|O_CREAT;
>
>right?
That, or
sysopen FH, $name, O_RDWR|O_CREAT;
>And we're full circle. I just ave you that command :)
So why do we, in general, insist on a syntax like
open FH, ">$name";
eh? Because it's simpler.
Now, something so common if you need file locking, needs a shortcut.
--
Bart.
------------------------------
Date: Tue, 06 Mar 2001 12:00:54 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: flock and close with empty read strangeness
Message-Id: <jck9at8sbq58kh78h9k5o7ul2q61p26c57@4ax.com>
Abigail wrote:
>There is little sense in having processes wait if they could go ahead
>because all they need is a shared lock. OTOH, you don't want exclusive
>lockers to wait forever, so a compromise has to be made.
The compromise, IMO, would be to queue demands for shared locks if a
demand for exclusive lock is in the queue.
--
Bart.
------------------------------
Date: 6 Mar 2001 12:54:38 GMT
From: abigail@foad.org (Abigail)
Subject: Re: flock and close with empty read strangeness
Message-Id: <slrn9a9nge.plq.abigail@tsathoggua.rlyeh.net>
Bart Lateur (bart.lateur@skynet.be) wrote on MMDCCXLIV September MCMXCIII
in <URL:news:jck9at8sbq58kh78h9k5o7ul2q61p26c57@4ax.com>:
,, Abigail wrote:
,,
,, >There is little sense in having processes wait if they could go ahead
,, >because all they need is a shared lock. OTOH, you don't want exclusive
,, >lockers to wait forever, so a compromise has to be made.
,,
,, The compromise, IMO, would be to queue demands for shared locks if a
,, demand for exclusive lock is in the queue.
And what compromise is that? My example shows a compromise.
Abigail
--
sub J::FETCH{Just }$_.='print+"@{[map';sub J::TIESCALAR{bless\my$J,J}
sub A::FETCH{Another}$_.='{tie my($x),$';sub A::TIESCALAR{bless\my$A,A}
sub P::FETCH{Perl }$_.='_;$x}qw/J A P';sub P::TIESCALAR{bless\my$P,P}
sub H::FETCH{Hacker }$_.=' H/]}\n"';eval;sub H::TIESCALAR{bless\my$H,H}
------------------------------
Date: Tue, 06 Mar 2001 12:48:12 +0100
From: Philip Newton <pne-news-20010306@newton.digitalspace.net>
Subject: Re: Grokking map and grep
Message-Id: <haj9ato90tcslfvt2jk24kvb0m5hugma7q@4ax.com>
On Tue, 06 Mar 2001 10:19:10 GMT, pjlees@ics.forthcomingevents.gr
(Philip Lees) wrote:
> print OUT map { ++$count; join ',', @$_ } sort { $$a[0] <=> $$b[0] }
> map { [ split /,/ ] } grep { /^\d+,/ } (<IN>);
Or you could remember the original line:
my @lines = map { $_->[1] }
sort { $a->[0] <=> $b->[0] }
map { [ (split /,/, $_, 2)[0], $_ ] }
grep { /^\d+,/ }
<IN>;
print OUT @lines;
print OUT "\n\nTotal: ", scalar(@lines), "\n";
> 2. Is there any trick for getting the scalar result of the leftmost
> map _as well as_ the list ouput, so that I could get rid of that
> annoying $count variable?
Well, the scalar result of map is the number of elements generated --
so assigning to an array and using that array in scalar context will
give you the answer. I can't think of how to do it without the
intermediate array variable, however.[1]
Cheers,
Philip
[1] Which kind of makes sense. All of map's output goes to the print
command and effectively disappears, as far as the Perl script is
concerned. If part of the output (the scalar value) should go
elsewhere, how would you express that it should go somewhere else? You
need a variable somewhere to hold it.
--
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: 6 Mar 2001 13:47:04 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Grokking map and grep
Message-Id: <982poo$7pd$1@mamenchi.zrz.TU-Berlin.DE>
According to Philip Lees <pjlees@ics.forthcomingevents.gr>:
> Hi. I had to write a script to read comma-delimited data from a file
> in a format like this:
>
> number, other data, other data, .....
>
> (There are also some junk lines that I'm not interested in - I only
> want the ones that begin with a number followed by a comma.)
>
> The lines must then be sorted numerically on the first (number) column
> and the output written to another file.
>
> I managed that OK, then I started thinking about grep and map, which I
> haven't fully grokked yet. I came up with the following:
>
> #!perl -w
>
> use strict;
>
> open ( IN, "ECG_done.txt" ) || die "Can't open input file: $!";
> open ( OUT, ">ECG_done_sorted.txt" ) || die "Can't open output file:
> $!";
>
> my $count;
> print OUT map { ++$count; join ',', @$_ } sort { $$a[0] <=> $$b[0] }
> map { [ split /,/ ] } grep { /^\d+,/ } (<IN>);
> print OUT "\n\nTotal: $count\n";
>
> close IN;
> close OUT;
>
> Now this is amazingly cool, being able to do all the reading,
> processing and writing with one line of code, but I have two
> questions:
>
> 1. For the small file I was dealing with, this is not a problem, but
> if I was working with a very large file would there be any
> advantages/disadvantages to doing it in the above way, rather than by
> splitting the input explicitly to an arrayof lists, sorting, then
> writing the new file from a foreach loop, as I did in the original
> version? I have this horrible gut feeling that the memory overhead of
> all those maps and greps could become huge. Is my feeling baseless?
Well, since you need to sort the data you'll need all of them in
memory anyway (unless let an external program do the sort). So this
is one of the cases where reading the whole file is justified. [1]
Still other stages in the grep/map "pipeline" may duplicate or
triplicate the overhead. In simple cases like "for ( 0 .. 1000000 )"
there are optimizations in place, but in cases like this I believe
the intermediate lists are fully expanded.
> 2. Is there any trick for getting the scalar result of the leftmost
> map _as well as_ the list ouput, so that I could get rid of that
> annoying $count variable?
I don't think so. You could assign the whole list to a variable
and use it in scalar context for the count. This would get rid
of the $count variable at the cost of keeping the list, not a
good deal, memory-wise.
Anno
[1] ...as opposed to things like
@lines = <IN>;
foreach ( @lines ) { ...
which I've seen more than once.
------------------------------
Date: Tue, 06 Mar 2001 14:39:38 +0000
From: "s.gatzhammer" <s.gatzhammer@novathink3.de>
Subject: Insert value into another window
Message-Id: <3AA4F6AA.A5E3054E@novathink3.de>
Hi!
We call the following script from a first window. A second window is
opened.
Calling procedure in the first window:
<input size=40 maxlength=40 name="Datei1" value="">
<input type=button onClick='ifield = document.forms[0].Datei1; chooser =
window.open("fileupload1.cgi?SID=$zeit&multi=0&user="+escape(ifield.value),
"chooser",
"toolbar=no,menubar=no,scrollbars=yes,width=500,height=s400");
chooser.ifield = ifield' value="Choose File..."><br>
Script in the second window:
use CGI::Carp qw/fatalsToBrowser/;
[...]
$JSCRIPT=<<EOF;
function select(f)
{
ifield.value = f;
window.frame[0].document.forms[0].Datei1.value = "$file"; // which
reference is needed here??
top.close();
return false;
}
EOF
;
print header();
print start_html(-title=>'File Upload Example',-script=>$JSCRIPT);
print h1('Choose file for upload');
# Start a multipart form.
print start_multipart_form(),
"Enter the file to process:",
filefield('filename','',45),
br,
p,
reset,submit('submit','Process File'),
endform;
# Process the form if there is a file name entered
if (my $file = param('filename'))
{
$mimetype = uploadInfo($file)->{'Content-Type'}|| '';
[...]
print "<a href=\"\" onClick='return
select(\"$file\")\'>$file</a>";
[...]
}
After this script is processed using the submit button we want to return
a value in a input field in the first window.
But we have no idea how. Please help!
bye
Sebb.
------------------------------
Date: Wed, 7 Mar 2001 00:53:00 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Insert value into another window
Message-Id: <slrn9a9qts.h9v.mgjv@martien.heliotrope.home>
On Tue, 06 Mar 2001 14:39:38 +0000,
s.gatzhammer <s.gatzhammer@novathink3.de> wrote:
> Hi!
>
> We call the following script from a first window. A second window is
> opened.
Please don't post stuff like this to a Perl group. Whatever happens on
the client side in web browser windows for these sorts of things has
nothing whatsoever to do with Perl. I'd appreciate it if people
following up to this in c.l.javascript could remove clp.misc from the
newsgroup list.
Martien
--
Martien Verbruggen |
Interactive Media Division | In the fight between you and the
Commercial Dynamics Pty. Ltd. | world, back the world - Franz Kafka
NSW, Australia |
------------------------------
Date: Tue, 6 Mar 2001 21:52:45 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Is Perl right for me?
Message-Id: <slrn9a9gbt.efn.mgjv@martien.heliotrope.home>
On Tue, 06 Mar 2001 10:16:15 GMT,
Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
> I was shocked! How could Martien Verbruggen <mgjv@tradingpost.com.au>
> say such a terrible thing:
>>On Tue, 06 Mar 2001 06:15:06 GMT,
>> Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
>>> |
>>> cat /dev/random | sed -e $SOME_SCRIPT > somefile.html
>>>
>>> I'm still working on it though
>>
>>So... What did you use to write $SOME_SCRIPT? Or is this a recursive
>>solution?
>
> Well, like, *duh*
>
> SOME_SCRIPT=`cat /dev/random | sed -e $SOME_OTHER_SCRIPT`
I see...
So... What did you use to write $SOME_OTHER_SCRIPT? Or is this a recursive
solution?
Martien
Oh, and, before Randal says it: useless use of cat!
--
Martien Verbruggen |
Interactive Media Division | Useful Statistic: 75% of the people
Commercial Dynamics Pty. Ltd. | make up 3/4 of the population.
NSW, Australia |
------------------------------
Date: Tue, 6 Mar 2001 13:00:25 +0100
From: "calimhero" <calimhero@galbord.com>
Subject: PHP Help me please !!!
Message-Id: <3aa4d153@kirchberg2.clt-ufa.net>
sorry for my questions here but i don't now where ask my question,
i am a new developper in php and i have a question :
i get the current month with
<?
print (date("F")) ;
?>
and i want the next month so how to please ????????
------------------------------
Date: Tue, 6 Mar 2001 14:11:16 +0100
From: "Peter Søgaard" <peter.s@tjgroup.dk>
Subject: Re: PHP Help me please !!!
Message-Id: <982neq$q9t$1@news.inet.tele.dk>
You're totally off-topic...
"calimhero" <calimhero@galbord.com> skrev i en meddelelse
news:3aa4d153@kirchberg2.clt-ufa.net...
> sorry for my questions here but i don't now where ask my question,
> i am a new developper in php and i have a question :
> i get the current month with
>
> <?
> print (date("F")) ;
> ?>
>
> and i want the next month so how to please ????????
>
>
------------------------------
Date: Tue, 06 Mar 2001 04:15:17 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Regex question (newbie)
Message-Id: <3AA4D4D5.58ADD995@stomp.stomp.tokyo>
Bart Lateur wrote:
> Godzilla! wrote:
> >Hmmm, maybe one-third ahead full. This regex method
> >displayed is quite slow and inefficient. Consider
> >using a substring method when possible.
> >$_ = "this, is a test";
> >$a = substr ($_, 0, index ($_, ",") + 1);
> If the guy is trying to learn about regexes, there's no need to optimize
> them away right now. Heck, if the rules change to "a comma wplus any
> whitespace following it", you HAVE to fall back to regexes.
"Consider using a substring method when possible."
Rather than worry about regex use, you should worry
about your poor reading comprehension skills.
Godzilla!
------------------------------
Date: 6 Mar 2001 07:30:46 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: RFC: FAQ3 update -- Using less memory
Message-Id: <9823n6$7r6$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Chris Fedde
<cfedde@fedde.littleton.co.us>],
who wrote in article <1kSo6.389$T3.189894656@news.frii.net>:
> ! Don't make anything global that doesn't have to be. Use my()
> ! prodigiously to localize variables to the smallest possible scope.
> ! Memory freed by variables that have gone out of scope can be reused
> ! elsewhere in the current program, preventing the need for additional
> ! allocations from system memory.
This ignores the fact that memory used by locals *is* reused, but one
used by lexicals *is not*.
But I'm not surprized. Perl's FAQ is much more a political document
than a reliable document....
Hope this helps,
Ilya
------------------------------
Date: Tue, 6 Mar 2001 21:58:20 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: statement for(list);
Message-Id: <slrn9a9gmc.efn.mgjv@martien.heliotrope.home>
On 6 Mar 2001 10:14:56 GMT,
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
> [A complimentary Cc of this posting was NOT sent to Martien Verbruggen
><mgjv@tradingpost.com.au>],
> who wrote in article <slrn9a99ru.efn.mgjv@martien.heliotrope.home>:
>> >> It's easy enough to define. process from right to left. n other words,
>> >> the right statement becomes the outer loop/block. My example would
>> >> become
>> >
>> > This is not how Perl's syntax is defined. One can define the same
>> > precedence for these operators and left associativity. Is this what
>> > you have in mind?
>>
>> Yes. Although I can't immediately see whether that would allow what I
>> want. Precedence would have to be low, maybe just below list ops..... or
>> maybe just above comma and =>. Somewhere around there anyway.
>
> Precedence is already defined (perldoc perlop) to be suitably low.
In perlop? The perlop from 5.6.0, or is this a later addition? If it is
in the 5.6.0 version, what is it called in the precedence list?
> The key observation is that you want *equal* precedence with
> left-associtivity. While easy-to-define, I'm not sure that this is
> 100% intuitive.
>
>> I was more wondering aloud why the decision was made to only allow one
>> of these modifiers, instead of extending it. Is it because these things
>> are currently not implemented as operators, and they would need to be?
>
> Because you need to define the relative precedence and associativity.
> Endless possibilities come into mind, which means that the readers
> will have hard time parsing the statements in their heads.
Ok. I can accept that. While I at this moment in time don't see why
simply making their precedence equal would confuse many people, I'm sure
it got discussed, and examples exist where it would indeed be confusing.
> (Parsing in C is not a problem, parsing in reader's heads is. People
> often confuse these two topics, resulting in observations like "TCL
> has a very simple syntax".)
tcl simple? Only people who have religious connections with that
language would maintain that.
Martien
--
Martien Verbruggen |
Interactive Media Division | If it isn't broken, it doesn't have
Commercial Dynamics Pty. Ltd. | enough features yet.
NSW, Australia |
------------------------------
Date: 6 Mar 2001 12:03:49 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: statement for(list);
Message-Id: <982jn5$co2$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was NOT sent to Martien Verbruggen
<mgjv@tradingpost.com.au>],
who wrote in article <slrn9a9gmc.efn.mgjv@martien.heliotrope.home>:
> >> Yes. Although I can't immediately see whether that would allow what I
> >> want. Precedence would have to be low, maybe just below list ops..... or
> >> maybe just above comma and =>. Somewhere around there anyway.
> >
> > Precedence is already defined (perldoc perlop) to be suitably low.
>
> In perlop? The perlop from 5.6.0, or is this a later addition? If it is
> in the 5.6.0 version, what is it called in the precedence list?
My bad... At least they are not in 5.005, which I "remembered" they
were in... OK, just add them at the end of the table (near the
beginning of perlop).
> Ok. I can accept that. While I at this moment in time don't see why
> simply making their precedence equal would confuse many people,
It would not confuse people who know this. But do you actually expect
people knowing all the 20-odd levels of precedence in Perl? What is
important is to have the precedence system "which flows smoothly with
users expectations". This is extremely hard to do. (I put several
words about how "floating precedences" may save the broken parts of
Perl precedence system in my w.p.com interview.)
Larry (IMO correctly) recognized this pitfall of allowing multiple
modifiers: you need to add and document yet-another-level. Note how
this level of precedence is "conveniently omitted" from perlop now.
> I'm sure it got discussed, and examples exist where it would indeed
> be confusing.
Of course it was not. Designed-by-committee Perl is mostly not.
Ilya
------------------------------
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 426
**************************************