[16206] in Perl-Users-Digest
Perl-Users Digest, Issue: 3618 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 11 06:05:30 2000
Date: Tue, 11 Jul 2000 03:05:14 -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: <963309914-v9-i3618@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 11 Jul 2000 Volume: 9 Number: 3618
Today's topics:
Re: about Net::SMTP <iltzu@sci.invalid>
Re: array, hashes = headaches (Neil Kandalgaonkar)
Bar graphs using Perl on HP-UX stuart_munn@my-deja.com
Re: Bar graphs using Perl on HP-UX <adetalabi@clara.co.uk>
Re: Comparing two strings (golf, anyone?) <bart.lateur@skynet.be>
Cookie & redirect <stephane@siw.ch>
Re: Cookies in Netscape: Redirect problem??? <jvddrift@aaa.nl>
Error "Out of Memory!" has me stumped <jdb@wcoil.com>
Re: Getting a unique machine ID on win32? <carvdawg@patriot.net>
Re: How do I tell PERL to create a new directory in Win (Villy Kruse)
if...elsif...else question <zakm@datrix.co.za>
Re: Need help with scheduling tasks without Cron <zakm@datrix.co.za>
Re: need post/lwp example <iltzu@sci.invalid>
Re: Net::SMTP question <iltzu@sci.invalid>
New to perl, need help <merlik@my-deja.com>
Re: New to perl, need help (Sam Holden)
Re: New to perl, need help <uackermann@orga.com>
Re: New to perl, need help <thoren@southern-division.com>
Re: off-topic, "Compiler" technology (Abigail)
Re: off-topic, "Compiler" technology <aotto@t-online.de>
Re: off-topic, "Compiler" technology (Bernard El-Hagin)
Re: off-topic, "Compiler" technology (Abigail)
rookie:delete <tags> in xml files? <jensknobloch@web.de>
search and replace, HELP tvn007@my-deja.com
search and replace, HELP tvn007@my-deja.com
Re: search and replace, HELP (Bernard El-Hagin)
Re: Shuffling an array <iltzu@sci.invalid>
Re: split NONSENSE <bart.lateur@skynet.be>
Re: split NONSENSE (Abigail)
Re: String length? (John Stanley)
Re: String length? (Sam Holden)
Re: String length? (Anno Siegel)
The problem of two Submit buttons <senthil.raja@adcc.alcatel.be>
Re: Unique Items philhibbs@my-deja.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 11 Jul 2000 08:33:05 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: about Net::SMTP
Message-Id: <963303822.26732@itz.pp.sci.fi>
In article <20000710231642.10552.00000072@ng-mb1.aol.com>, Haazi2 wrote:
>How do you carbon copy to an email address using Net::SMTP?
$smtp->to($address);
If you want a Cc: header to appear in the message, you should add one.
You don't have to, though - that's how you make a blind carbon copy.
The secret of SMTP is that there's very little magic in the message
headers. It's all done with smoke and mirrors by the mail software.
--
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: Tue, 11 Jul 2000 09:45:13 GMT
From: neil@brevity.org (Neil Kandalgaonkar)
Subject: Re: array, hashes = headaches
Message-Id: <8kepv6$n3h$1@localhost.localdomain>
In article <smlb4huinu124@corp.supernews.com>,
moishe <moishe@mitechnyc.com> wrote:
>while ( <DATA> ) {
> if ( /UID:\s+(.+)/ {
> $uid=$1;
> }
> if ( /Address:\s+(.+)/ ) {
> $users{$uid}{$address} = $1;
^^^^^^^^
> }
> if ( /Phone:\s+(.+)/ ) {
> $users{$uid}{$phone} = $1;
^^^^^^
> }
>}
I don't see you defining the variables $address or $phone.
If they haven't been initialized, perl will treat that like
$users{$uid}{''} = $1;
# later...
$users{$uid}{''} = $1;
Which would give the symptoms you saw; a hash with a single
item, the key is "invisible", and the value is the last thing set.
By the way, if you use #!/usr/bin/perl -w, perl warns you about
that sort of thing.
You really should be doing:
$users{$uid}{'address'} = $1;
# later...
$users{$uid}{'phone'} = $1;
--
Neil Kandalgaonkar <neil@brevity.org>
------------------------------
Date: Tue, 11 Jul 2000 08:52:08 GMT
From: stuart_munn@my-deja.com
Subject: Bar graphs using Perl on HP-UX
Message-Id: <8ken7l$6bs$1@nnrp1.deja.com>
I want to create some simple bar-graphs on HP-UX 10.20. Output must be
gif or png.
Has anyone got experience and advice they can share with me?
Regards
Stuart
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 11 Jul 2000 10:34:24 +0100
From: Ade Talabi <adetalabi@clara.co.uk>
Subject: Re: Bar graphs using Perl on HP-UX
Message-Id: <396AEA20.65033ECF@clara.co.uk>
stuart_munn@my-deja.com wrote:
>
> I want to create some simple bar-graphs on HP-UX 10.20. Output must be
> gif or png.
>
> Has anyone got experience and advice they can share with me?
>
> Regards
>
> Stuart
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
there are some graph modules @ CPAN
--
/--------------------------------------------------------------\
| Ade Talabi | Internet : adetalabi@clara.co.uk |
| ::M1ETW:: | Web Page : http://www.net-africa.com |
\--------------------------------------------------------------/
------------------------------
Date: Tue, 11 Jul 2000 10:54:53 +0200
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Comparing two strings (golf, anyone?)
Message-Id: <q2mlms4jvh4ijtcs3c1c4kc16ip80kt1cp@4ax.com>
Randal L. Schwartz wrote:
>I think the answer you want is something along these lines:
>
> sub compare {
> ("$_[0]" ^ "$_[1]") =~ /^(\0*)/;
> length $1;
> }
I think it's more
sub compare {
return scalar(() = ("$_[0]" ^ "$_[1]") =~ /(\0)/g);
}
Yours calculates the length of a common prefix; what he wants is the
count of equal characters at a position, no matter what precedes it.
--
Bart.
------------------------------
Date: Tue, 11 Jul 2000 07:53:33 GMT
From: "Chello" <stephane@siw.ch>
Subject: Cookie & redirect
Message-Id: <1oAa5.18598$7D2.310924@news.chello.at>
HI all,
I'm looking to send a cookie and then redirect my user on a new page. The
problem is if I send the cookie I'm not redirected and if I redirect the
user I don't send the cookie....
Here is my code:
use CGI;
$q = new CGI;
my $url="http://www.siw.ch";
my $cook_value="work";
my
$cookie=$q->cookie(-name=>'mysite.com',-value=>$cook_value,-expires=>'+1y');
print $q->redirect(-cookie=>$cookie,-URL=>$url);
I'm using IIS4 under NT4 SP6 (I don't know if this server can provide that
error...).
Thanks a lot.
Stéphane
----------------------------------------------------------------------------
---------------
Don't forget
http://www.maldivesresorts.com
------------------------------
Date: Tue, 11 Jul 2000 09:53:57 +0200
From: JWJ van der Drift <jvddrift@aaa.nl>
Subject: Re: Cookies in Netscape: Redirect problem???
Message-Id: <396AD295.6C67AD1B@aaa.nl>
Drew Simonis wrote:
>
> Since this is obviously not a Perl problem, you'd be best aided by
> posting in a NG dedicated to CGI behaviour. Perhaps you meant to
> post to comp.infosystems.www.authoring.cgi
>
Ok! I'll try that. Thanx anyway.
Joost
------------------------------
Date: 11 Jul 2000 07:50:23 GMT
From: "Josiah Bryan" <jdb@wcoil.com>
Subject: Error "Out of Memory!" has me stumped
Message-Id: <8kejjv$9lp$0@206.230.71.62>
Greetings perlfolk,
I have run into a problem that I cannot seem to find an answer for,
and so I once again come humbly to you, the perl gurus asking
for a bit of wisdom and guidance.
Here is a direct transcript from the telnet window:
[root cgi-bin]# perl jcart.pl
Out of memory!
[root cgi-bin]#
No line numbers, nothing. What the script is doing:
It loads a database file from disk that occupies
390973 bytes on disk into memory using the Storable
module. Now, when I ran a "top" from telnet,
it reports the following (edited for conciseness):
(...)
Mem: 31064K av, 27904K used, 3160K free, 30496K shrd, 1844K buff
Swap: 130748K av, 3988K used, 126760K free 10108K cached
(...)
As you can see, it says I have 3160K free (remember, the file Ilm trying to
load is only 390K), with
the script itself being 19K on disk, and any extra size added by Storable
(which is of course,
autoloaded) and my database module, which is 26K on disk. Since the file is
written by
Storable to disk, I am guessing that the 390K is a pretty accurate assement
of the size in memory.
Also of note, when I comment out the line that loads the disk file of 390K,
it fails on the next
attempt to load another database file, this next one being only 2013 bytes
on disk.
My server (the system giving the memory error) is a Linux-based server
running the Cobalt OS
in a Cobalt RaQ2 server hosted by Interliant with 3Gig HD and memory listed
above.
The scripts all run fine locally on my perl5.005 inst (yes, ActiveState
[gasp!!!]) with 64MB of physical
ram (system properties in win98 list system resources at 27% free...and the
scripts loading the
large files still run fine).
I cannot seem to understand why this is giving memory errors on such a small
(relativly speaking)
file with this system setup. Is there some Perl internal thing going on that
I'm not aware of?
Any help would be greatly appreciated. I have spent the past half hour
searching postings in CLPM,
I also searched with "perldoc -q memory" and I read "perldoc perl5005delta".
The only thing that
I came up with that even mentioned an "out of memory" error was near the end
of perl5005delta,
item "Out of memory during ridiculously large request". Even that didn't
provide much insight into the
problem. "perldoc Storable" lists the authors benchmark tests with files in
the Megabyte size range,
so I would think Storable should have no problem with a simple 390k of data.
Any thing anybody
can say in way of possible guidance would be greatly appreciated
Also, if I you could possibly reply via email to vp@tdcj.com
I would greatly appreciate it. Thankyou very much.
--
Josiah Bryan
VP of Product Development
TDCJ, Inc.
"Anything is possible."
vp@tdcj.com
http://www.josiah.countystart.com/
Tel: 937.316.6256
------------------------------
Date: Tue, 11 Jul 2000 05:34:12 -0400
From: H C <carvdawg@patriot.net>
Subject: Re: Getting a unique machine ID on win32?
Message-Id: <396AEA14.8BEA3D9@patriot.net>
Would the SID be unique enough?
TM wrote:
> Seriously now
>
> Drew Simonis a écrit :
>
> > TM wrote:
> > >
> > > Hello,
> > >
> > > I'm looking for a way of getting a machine's unique ID (e.g. hard drive
> > > number or a microprocessor ID).
> > >
> >
> > An earlier thread discussed this same exact topic. I recall the
> > decided solution was to use a screwdriver.
------------------------------
Date: 11 Jul 2000 08:19:52 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: How do I tell PERL to create a new directory in Win32?
Message-Id: <slrn8mlm57.3r6.vek@pharmnl.ohout.pharmapartners.nl>
On 11 Jul 2000 03:59:29 GMT, sky <tbsky.bbs@openbazaar.net> wrote:
>¡° ¤Þz¡mvek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)¡n¤§»Ê¨¥¡G
>> On 08 Jul 2000 03:13:58 GMT, sky <tbsky.bbs@openbazaar.net> wrote:
>> > i never got success when using this kind of command.
>> > i use linux and hp-ux.
>> > mkdir "Mydir",'0777'
>> > this command won't set the directory permission to "0777"
>> > i don't know how to create directory with the permissions
>> > i want...
>> > can anyone tell me how to do this?
>> > thanks for u help !!!
>> And what is your umask value. This umask can be set in your shell profile
>> and defines some bits which should be subtracted from all creation modes
>> when you create files or directories. If umask is 022 then when
>> you create a directory with permissions you get 755 because of the unask.
>> There should be a umask procedure in the POSIX module, which can be used
>> to modify it.
>> Villy
>
> i know how to create a directory with "umask" and "mkdir" under shell.
> but i don't know how to do with perl's "mkdir"...
> can u show me an example to create a directory with permission
> "0777"?
> thanks for ur help!!!
>
> Best Regards,
> Tbsky
Do it the same way in Perl.
#!/usr/bin/perl -w
use strict;
use POSIX;
my $oldumask = umask(0);
printf "old umask is %o\n", $oldumask;
mkdir "/var/tmp/testdirectory", 0777 or die "mkdir error $!";
umask ($oldumask);
__END__
old umask is 77
drwxrwxrwx 2 1024 Jul 11 10:17 /var/tmp/testdirectory
__
Villy
------------------------------
Date: Tue, 11 Jul 2000 11:36:32 +0200
From: Zak McGregor <zakm@datrix.co.za>
Subject: if...elsif...else question
Message-Id: <396AEAA0.F6947C52@datrix.co.za>
Hi all
From the perlsyn manpage:
" or even, horrors,
if (/^abc/)
{ $abc = 1 }
elsif (/^def/)
{ $def = 1 }
elsif (/^xyz/)
{ $xyz = 1 }
else
{ $nothing = 1 } "
Is this style of doing switch-like things what scored it the 'horrors'
tag or is it something else? If that block of code was indented better
it would lokk fine, IMHO. Perhaps it is less efficient?
Thanks
------------------------------
Date: Tue, 11 Jul 2000 11:53:41 +0200
From: Zak McGregor <zakm@datrix.co.za>
Subject: Re: Need help with scheduling tasks without Cron
Message-Id: <396AEEA5.4258EFCD@datrix.co.za>
pastan@my-deja.com wrote:
> Hello All,
>
> I don't have an opportunity to use Cron or similar features. How can I
> implement scheduling by means of Perl functions such as fork, kill,...?
That will all depend on your OS. Feel like hinting (just a little) please?
Ciao
------------------------------
Date: 11 Jul 2000 08:04:20 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: need post/lwp example
Message-Id: <963302170.23864@itz.pp.sci.fi>
In article <396A3D30.DEC49AD3@dal.asp.ti.com>, Bill Webster wrote:
> #!/usr/bin/perl
> use LWP::UserAgent;
> $ua = LWP::UserAgent->new;
>
> my $req = HTTP::Request->new(POST => 'http://www.perl.com/cgi-bin/BugGlimpse');
> $req->content_type('application/x-www-form-urlencoded');
> $req->content('match=www&errors=0');
>
> my $res = $ua->request($req);
> print $res->as_string;
>
> ...well http://www.perl.com/cgi-bin/BugGlimpse no longer exists, so
>its hard for me to play with this example.
Well, just pick any old script. It'd probably be best for you to run
your own test script, but you can play with one of mine if you want:
my $req = HTTP::Request->new(POST => 'http://www.sci.fi/~iltzu/cgi-bin/figlet.pl');
$req->content_type('application/x-www-form-urlencoded');
$req->content('text=Hello,+world!&font=big');
--
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: 11 Jul 2000 08:39:02 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Net::SMTP question
Message-Id: <963304657.28169@itz.pp.sci.fi>
In article <8ke7rf$rgh$1@nnrp1.deja.com>, yong321@yahoo.com wrote:
>Just found that some email addresses in our database are so wrong that
>they're even syntactically incorrect, for example, "test@". I wonder if
>my program aborts the loop rather than skips (ignores) these bad
>addresses.
Don't wonder, check if it does. And then take a look at the Net::SMTP
docs, especially the part about "SkipBad"..
--
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: Tue, 11 Jul 2000 08:08:37 GMT
From: Merlik <merlik@my-deja.com>
Subject: New to perl, need help
Message-Id: <8keklv$4qi$1@nnrp1.deja.com>
I've recently decided to learn Perl. In an effort to test my
capabilities, I'm going to attempt to re-write every program I was
assigned in a computer science class(C++). The first program I tried
was a program that uses recursive functions to calculate elements of
the fibonnaci sequence.
#!/usr/bin/perl
print "Input a number: ";
chop($number = <STDIN>);
print "Result: ", fibonacci($number + 1), "\n";
sub fibonacci ($number) {
return 1 if $number == 1;
return 0 if $number == 0;
return fibonacci($number - 1) + fibonacci($number - 2);
}
When I try to compile(interpret?) it, it displays the input prompt and
then hangs. Any suggestions?
-- Merlik
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 11 Jul 2000 08:40:15 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: New to perl, need help
Message-Id: <slrn8mlnbf.lk4.sholden@pgrad.cs.usyd.edu.au>
On Tue, 11 Jul 2000 08:08:37 GMT, Merlik <merlik@my-deja.com> wrote:
>I've recently decided to learn Perl. In an effort to test my
>capabilities, I'm going to attempt to re-write every program I was
>assigned in a computer science class(C++). The first program I tried
>was a program that uses recursive functions to calculate elements of
>the fibonnaci sequence.
>
>#!/usr/bin/perl
>
>print "Input a number: ";
>chop($number = <STDIN>);
>print "Result: ", fibonacci($number + 1), "\n";
>
>sub fibonacci ($number) {
> return 1 if $number == 1;
> return 0 if $number == 0;
> return fibonacci($number - 1) + fibonacci($number - 2);
>}
>
>When I try to compile(interpret?) it, it displays the input prompt and
>then hangs. Any suggestions?
You could try reading the perlsub documentation and checking what the
syntax for a subroutine in perl is, instead of just guessing....
perldoc perlsub
--
Sam
PC's are backwards ... throw them out! Linux is ok though.
--Rob Pike (on the subject of CR/LF etc)
------------------------------
Date: Tue, 11 Jul 2000 11:22:20 +0200
From: Ulrich Ackermann <uackermann@orga.com>
Subject: Re: New to perl, need help
Message-Id: <396AE74C.1AE0BBE6@orga.com>
Merlik wrote:
> #!/usr/bin/perl
You missed the "-w" switch and the "use strict;" pragma here
wich gives you always good hints, when something is wrong!
#!/usr/bin/perl -w
use strict;
>
> print "Input a number: ";
> chop($number = <STDIN>);
You have to put a "my in front of the variable now (because using
strict)
chop(my $number = <STDIN>);
> print "Result: ", fibonacci($number + 1), "\n";
>
> sub fibonacci ($number) {
In Perl this is "sub fibonacci {" without the ($number) part
But you have to add the line "my $number = shift;"
> return 1 if $number == 1;
> return 0 if $number =#!/usr/local/bin/perl -w
> return fibonacci($number - 1) + fibonacci($number - 2);
> }
Altogether it now looks like this:
#!/usr/local/bin/perl -w
use strict;
print "Input a number: ";
chomp (my $number = <STDIN>);
print "Result: ", fibonacci($number + 1), "\n";
sub fibonacci {
my $number = shift;
return 1 if $number == 1;
return 0 if $number == 0;
return fibonacci($number - 1) + fibonacci($number - 2);
}
HTH, Ulrich
--
Ulrich Ackermann
ORGA Kartensysteme GmbH (SY-PEAT-STA)
Tel.:+49.5254.991-925
mailto:uackermann@orga.com
------------------------------
Date: Tue, 11 Jul 2000 11:49:30 +0200
From: "Thoren Johne" <thoren@southern-division.com>
Subject: Re: New to perl, need help
Message-Id: <8keqlv$jbv$17$1@news.t-online.com>
Ulrich Ackermann <uackermann@orga.com> wrote in message
news:396AE74C.1AE0BBE6@orga.com...
> print "Input a number: ";
on my windows system it's better to unbuffer the output by
$| = 1;
before the first print statement.
if you don't, the shell is waiting for input before it prints the "Input a
number: " request.
gruß
thoren
8#X
--
----------------------------------------------------------------------
Thoren Johne - 8#X - thoren@southern-division.com
Southern Division Classic Bikes - www.southern-division.com
------------------------------
Date: 11 Jul 2000 04:05:54 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: off-topic, "Compiler" technology
Message-Id: <slrn8mlmch.am3.abigail@alexandra.delanet.com>
Andreas Otto (aotto@t-online.de) wrote on MMDVI September MCMXCIII in
<URL:news:396ABBDB.FFCD95A4@t-online.de>:
][
][ Sorry,
][
][ this is off topic but i think very interesting for the
][ perl community.
][
][ At http://home.t-online.de/home/aotto/comp-main_E.html
][
][ you can download a *real* tcl compiler. It compiles
][ *every* tcl or tk script into *native* very very fast
][ C code and creates an executable or dynamic library.
][
][ The underlying technology "Token-Stream" works for all
][ scripting languages like *perl* or *python* too.
Let us know when you've finished the Perl port of your compiler.
Or else, it's just vaporware.
Abigail
--
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");
------------------------------
Date: Tue, 11 Jul 2000 10:10:25 +0200
From: Andreas Otto <aotto@t-online.de>
Subject: Re: off-topic, "Compiler" technology
Message-Id: <396AD671.2B893A11@t-online.de>
Hi,
> Let us know when you've finished the Perl port of your compiler.
>
> Or else, it's just vaporware.
it's not vaporware for TCL but vaporware for PERL
I currently working on the Java back-end which compiles
every TCL or TK script into native JAVA
mfg
aotto :)
--
================================================================
Andreas Otto Phone: ++49-(0)8152-399540
IPN Ingenieurbuero fuer mailto:aotto@t-online.de
Praezisionsnumerik Web: http://home.t-online.de/home/aotto
Ulmenstrasse 3 Skills: Unix,Sql,Tcl,Shell,Sybase...
D-34289 Zierenberg Area: Bank, FX, MM, shares, options
=================================================================
------------------------------
Date: Tue, 11 Jul 2000 08:32:12 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: off-topic, "Compiler" technology
Message-Id: <slrn8mlmjr.9rf.bernard.el-hagin@gdndev25.lido-tech>
On Tue, 11 Jul 2000 10:10:25 +0200, Andreas Otto <aotto@t-online.de> wrote:
>
>Hi,
>
>> Let us know when you've finished the Perl port of your compiler.
>>
>> Or else, it's just vaporware.
>
> it's not vaporware for TCL but vaporware for PERL
>
> I currently working on the Java back-end which compiles
> every TCL or TK script into native JAVA
That's endlessly fascinating and mindnumbingly interesting but WHAT THE
HELL DOES IT HAVE TO DO WITH PERL???
Bernard
--
perl -e'@x=(3,2,4,1,3,2,1,3,1,3,2,3,3,2,3,0,0,1,2,1,1,1,4,1,2,1,1,2,2,1,
2,1,2,1,2,1,2,1,1,1,2,1,0,0,3,2,3,2,3,2,1,1,1,1,1,2,4,2,3,2,1,2,1,0,0,1,
2,1,1,1,4,1,2,1,1,1,2,2,1,1,4,1,1,1,2,1,1,1,2,1,0,0,3,2,4,1,1,2,1,1,1,3,
1,1,1,4,1,1,1,2,1,1,3,0,0);sub x{print q x$xx$_;print q x x x shift@x};#
while(defined($_=shift @x)){s o0o\no;$_!=0?x:print}' #Symmetry yrtemmyS#
------------------------------
Date: 11 Jul 2000 05:01:22 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: off-topic, "Compiler" technology
Message-Id: <slrn8mlpki.am3.abigail@alexandra.delanet.com>
Andreas Otto (aotto@t-online.de) wrote on MMDVI September MCMXCIII in
<URL:news:396AD671.2B893A11@t-online.de>:
//
// Hi,
//
// > Let us know when you've finished the Perl port of your compiler.
// >
// > Or else, it's just vaporware.
//
// it's not vaporware for TCL but vaporware for PERL
This group is about Perl. Hence, vaporware.
// I currently working on the Java back-end which compiles
// every TCL or TK script into native JAVA
That is very nice I guess, but what does that have to do with Perl?
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
------------------------------
Date: Tue, 11 Jul 2000 11:09:10 +0200
From: "JENS KNOBLOCH" <jensknobloch@web.de>
Subject: rookie:delete <tags> in xml files?
Message-Id: <OSFa5.254$42.170160640@news.bayou.com>
Hi list;
How can I delete text between special <tags> in a xml-file with a
perl-script??
I need to search a xml-file, delete some text between tags und output the
"cleaned" file to another file.
However, I don't know exactly how?
Could anyone help me?
THX
jens
------------------------------
Date: Tue, 11 Jul 2000 07:21:25 GMT
From: tvn007@my-deja.com
Subject: search and replace, HELP
Message-Id: <8kehte$302$1@nnrp1.deja.com>
Hi,
Thanks in advance for any help.
I have a small sample of data to show. However, the actual
data might have more than 200 columns and thousands of rows.
Here is the small sample of data:
H 1
H X
L X
1 X
L L
0 X
1 X
0 H
H X
0 0
1 0
1 1
I would like the output of column #2 as follow:
Here are the rules:
Rule#1 : L and H in column# 2 must be surround by X.
Rule#2 : Replace X with 1 anywhere else in column #2 . However, do not
violate Rule #1.
H 1
H 1
L 1
1 X
L L
0 X
1 X
0 H
H X
0 0
1 0
1 1
THanks for any help,
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 11 Jul 2000 07:23:23 GMT
From: tvn007@my-deja.com
Subject: search and replace, HELP
Message-Id: <8kei14$30e$1@nnrp1.deja.com>
Hi,
Thanks in advance for any help.
I have a small sample of data to show. However, the actual
data might have more than 200 columns and thousands of rows.
Here is the small sample of data:
H 1
H X
L X
1 X
L L
0 X
1 X
0 H
H X
0 0
1 0
1 1
I would like the output of column #2 as follow:
Here are the rules:
Rule#1 : L and H in column# 2 must be surround by X.
Rule#2 : Replace X with 1 anywhere else in column #2 . However, do not
violate Rule #1.
H 1
H 1
L 1
1 X
L L
0 X
1 X
0 H
H X
0 0
1 0
1 1
THanks for any help,
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 11 Jul 2000 07:41:43 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: search and replace, HELP
Message-Id: <slrn8mljl5.9rf.bernard.el-hagin@gdndev25.lido-tech>
On Tue, 11 Jul 2000 07:23:23 GMT, tvn007@my-deja.com <tvn007@my-deja.com> wrote:
>Hi,
>
>Thanks in advance for any help.
>
>I have a small sample of data to show. However, the actual
>data might have more than 200 columns and thousands of rows.
>
>Here is the small sample of data:
>
> H 1
> H X
> L X
> 1 X
> L L
> 0 X
> 1 X
> 0 H
> H X
> 0 0
> 1 0
> 1 1
>
>I would like the output of column #2 as follow:
>
>Here are the rules:
>
>Rule#1 : L and H in column# 2 must be surround by X.
>Rule#2 : Replace X with 1 anywhere else in column #2 . However, do not
>violate Rule #1.
>
>
> H 1
> H 1
> L 1
> 1 X
> L L
> 0 X
> 1 X
> 0 H
> H X
> 0 0
> 1 0
> 1 1
So what have you tried so far? Show us a snippet. Ahww, c'mon, just a
snippet.
Bernard
--
perl -e'@x=(3,2,4,1,3,2,1,3,1,3,2,3,3,2,3,0,0,1,2,1,1,1,4,1,2,1,1,2,2,1,
2,1,2,1,2,1,2,1,1,1,2,1,0,0,3,2,3,2,3,2,1,1,1,1,1,2,4,2,3,2,1,2,1,0,0,1,
2,1,1,1,4,1,2,1,1,1,2,2,1,1,4,1,1,1,2,1,1,1,2,1,0,0,3,2,4,1,1,2,1,1,1,3,
1,1,1,4,1,1,1,2,1,1,3,0,0);sub x{print q x$xx$_;print q x x x shift@x};#
while(defined($_=shift @x)){s o0o\no;$_!=0?x:print}' #Symmetry yrtemmyS#
------------------------------
Date: 11 Jul 2000 08:15:23 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Shuffling an array
Message-Id: <963303010.25313@itz.pp.sci.fi>
[jeopardectomy performed - please put replies _after_ quoted text]
In article <6mwa5.11645$BS1.339272@brie.direct.ca>, Marcus Ouimet wrote:
>Abigail <abigail@delanet.com> wrote in message
>news:slrn8ml2dr.7v7.abigail@alexandra.delanet.com...
>> Marcus Ouimet (mouimet@direct.ca) wrote on MMDV September MCMXCIII in
>> <URL:news:fgsa5.102456$Do1.1116067@news1.rdc1.bc.home.com>:
>> $$
>> $$ srand(time ^ $$);
>>
>> The FAQ also explains why this is very, very, very bad.
>
>Yes I did read it, I am new to perl and couldn't get it to shuffle any other
>way. I was at least able to get srand to work. Anyways...
^^^^^^^^^^^^^^^^^
You did? You must have a most interesting definition of "work", then.
One that seems to include "perform worse than if you'd left it alone".
--
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: Tue, 11 Jul 2000 10:54:55 +0200
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: split NONSENSE
Message-Id: <gnmlmskqpkru3s27jmqjvlem6tv3j5v22c@4ax.com>
kj0 wrote:
>Consider the following Absurd Perl Behavior:
> DB<1> x (split /:/, ":a")
> DB<2> x (split /:/, "a:")
There IS some absurd behaviour, but not the one you mention. That is
documented. Here's mine:
$\ = "\n";
@a = split /:/, '', -1;
print scalar @a;
@a = split /:/, 'x', -1;
print scalar @a;
-->
0
1
Hey, I wanted 1 twice!
$\ = "\n"; $, = "\t";
for my $i (0 .. 5) {
$_ = ':' x $i;
my @a = split /:/, $_, -1;
print $i, scalar @a;
}
-->
0 0
1 2
2 3
3 4
4 5
5 6
There is no way to make split() return a list of one item, if the string
parts are empty strings.
--
Bart.
------------------------------
Date: 11 Jul 2000 05:07:04 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: split NONSENSE
Message-Id: <slrn8mlpv7.am3.abigail@alexandra.delanet.com>
Bart Lateur (bart.lateur@skynet.be) wrote on MMDVI September MCMXCIII in
<URL:news:gnmlmskqpkru3s27jmqjvlem6tv3j5v22c@4ax.com>:
-- kj0 wrote:
--
-- >Consider the following Absurd Perl Behavior:
-- > DB<1> x (split /:/, ":a")
-- > DB<2> x (split /:/, "a:")
--
-- There IS some absurd behaviour, but not the one you mention. That is
-- documented. Here's mine:
--
-- $\ = "\n";
-- @a = split /:/, '', -1;
-- print scalar @a;
-- @a = split /:/, 'x', -1;
-- print scalar @a;
-- -->
-- 0
-- 1
--
-- Hey, I wanted 1 twice!
--
-- $\ = "\n"; $, = "\t";
-- for my $i (0 .. 5) {
-- $_ = ':' x $i;
-- my @a = split /:/, $_, -1;
-- print $i, scalar @a;
-- }
-- -->
-- 0 0
-- 1 2
-- 2 3
-- 3 4
-- 4 5
-- 5 6
--
-- There is no way to make split() return a list of one item, if the string
-- parts are empty strings.
Sure there is.
@a = split /:/ => ":", 1;
print scalar @a;
__END__
1
HTH. HAND.
Abigail
--
print v74.117.115.116.32, v97.110.111.116.104.101.114.32,
v80.101.114.108.32, v72.97.99.107.101.114.10;
------------------------------
Date: 11 Jul 2000 07:35:42 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: String length?
Message-Id: <8keioe$j5v$1@news.NERO.NET>
In article <x766qdmhjs.fsf@home.sysarch.com>,
Uri Guttman <uri@sysarch.com> wrote:
>that was my whole point. your answer wasn't amusing. the two lines that
>did nothing is not part of writing bad but working code.
I think I've already explained that I wasn't trying to write WORKING
code. I was trying to introduce the idea of MAIL as a way of counting
the length of a string. That's it. Isn't that silly? Wouldn't you laugh
at someone who came to you and suggested it? Or would you correct his
failure to assign to $_ and let him use the method?
I'm sorry that my failure to properly use the =~ operator got in the way
you the joke for you. The =~ operator wasn't the important part of the
message.
> i can write
>anything long by adding extraneous lines that do nothing.
I wasn't trying to write something long. I was presenting another
ludicrous way of counting string lengths. It wasn't supposed to be
used.
------------------------------
Date: 11 Jul 2000 07:56:22 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: String length?
Message-Id: <slrn8mlkp6.j41.sholden@pgrad.cs.usyd.edu.au>
On 11 Jul 2000 07:35:42 GMT, John Stanley <stanley@skyking.OCE.ORST.EDU> wrote:
>In article <x766qdmhjs.fsf@home.sysarch.com>,
>> Oops I snipped the reference to Uri:
>
>I'm sorry that my failure to properly use the =~ operator got in the way
>you the joke for you. The =~ operator wasn't the important part of the
>message.
>
>> i can write
>>anything long by adding extraneous lines that do nothing.
>
>I wasn't trying to write something long. I was presenting another
>ludicrous way of counting string lengths. It wasn't supposed to be
>used.
But if it doesn't work then it isn't a way to find the length of a string.
This is comp.lang.perl.misc... amazingly convoluted and long ways of doing
things is a past time, so is amazingly short and hard to understand ways of
doing things. However, if the method doesn't actually work it is less
funny, and just indicates the author didn't think about the perl part very
well.
--
Sam
Computers in the future may weigh no more than 1.5 tons.
--Popular Mechanics, 1949
------------------------------
Date: 11 Jul 2000 09:57:12 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: String length?
Message-Id: <8ker1o$26a$1@lublin.zrz.tu-berlin.de>
Abigail <abigail@delanet.com> wrote in comp.lang.perl.misc:
> chop, $l ++ untill /^\z/;
Ha, untested!
Anno
------------------------------
Date: Tue, 11 Jul 2000 15:15:36 +0530
From: Senthil Raja <senthil.raja@adcc.alcatel.be>
Subject: The problem of two Submit buttons
Message-Id: <396AECC0.E4388A98@adcc.alcatel.be>
Lets say I have a form with name="training"
and in that form I have two submit buttons like,
<input type=submit name=add value=ADD>
<input type=submit name=remove value=REMOVE>
In my CGI script I need to identify which submit button
submitted the form because based upon the button that submitted
the form I need to perform different actions.
How do I do that?
SenthilRaja.
------------------------------
Date: Tue, 11 Jul 2000 09:40:43 GMT
From: philhibbs@my-deja.com
Subject: Re: Unique Items
Message-Id: <8keq2q$88o$1@nnrp1.deja.com>
So, what does this do:
@out = grep(!$saw{s/(.*)/xxx$1/}++, @in);
I expected (hoped) that it would create an array of unique items,
with "xxx" prepended to each.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3618
**************************************