[16668] in Perl-Users-Digest
Perl-Users Digest, Issue: 4080 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 21 11:06:12 2000
Date: Mon, 21 Aug 2000 08:05:16 -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: <966870315-v9-i4080@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 21 Aug 2000 Volume: 9 Number: 4080
Today's topics:
Are BEGIN and END blocks user callable? <karner@fore.com>
Re: Cookie problem (chrs in value) (Abigail)
Generating a directory list... <nick.allen@tbwa-europe.com>
Re: Generating a directory list... (Martien Verbruggen)
Re: Getting rid of extra spaces and returns <aqumsieh@hyperchip.com>
Re: Hash List Comparing (Abigail)
Re: Help with quotewords j355@my-deja.com
Re: HELP: TEXTAREA field and newlines (Abigail)
Re: how to generate unreadable from readable perl code (Martien Verbruggen)
Re: how to generate unreadable from readable perl code (Anno Siegel)
Re: how to generate unreadable from readable perl code (Abigail)
Re: how to generate unreadable from readable perl code (Abigail)
Re: how to generate unreadable from readable perl code (Martien Verbruggen)
Re: how to generate unreadable from readable perl code (Anno Siegel)
Re: HTML <pmcclean@nortelnetworks.com>
Re: join on two arrays (Abigail)
New posters to comp.lang.perl.misc <gbacon@cs.uah.edu>
Re: New posters to comp.lang.perl.misc (Martien Verbruggen)
Re: Opening new processes... (Martien Verbruggen)
Re: Opening new processes... (Martien Verbruggen)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 21 Aug 2000 10:52:45 -0400
From: Keith Arner <karner@fore.com>
Subject: Are BEGIN and END blocks user callable?
Message-Id: <Pine.GSO.4.20.0008211046560.14895-100000@zimbra>
If I have an END block in a package, is there any way to invoke the end
block manually? That is:
package foo;
sub END {
do_something();
}
package main;
foo::END();
... will produce "Undefined subroutine &foo::END called at ..."
Do BEGIN and END blocks actually appear in the symbol table anywhere?
In this example, I could simply call do_something() directly, but I would
prefer to be able to invoke END().
Thanks,
Keith
--
------------------------------
Date: 21 Aug 2000 14:25:55 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Cookie problem (chrs in value)
Message-Id: <slrn8q2eua.tj3.abigail@alexandra.foad.org>
Liam Gretton (ljg@star.le.ac.uk) wrote on MMDXLVII September MCMXCIII in
<URL:news:ant21114626eWhac@xmm4.xra.le.ac.uk>:
?? Hi,
??
?? I'm trying to set a cookie where the value is a user's e-mail address. The
?? '@' symbol in the address is getting escaped to %40, but something's not
?? quite right because the browser is storing the cookie value as
??
?? ljg tar.le.ac.uk
??
?? (that's 40 spaces, and the 's' is missing) instead of
??
?? ljg%40star.le.ac.uk
??
?? Any idea what I'm doing wrong?
Well, if things are happening at you tell us here, it surely is a
browser bug.
Contact the vendor of the browser with the bug.
Abigail
--
perl -e 'for (s??4a75737420616e6f74686572205065726c204861636b65720as?;??;??)
{s?(..)s\??qq \?print chr 0x$1 and q ss\??excess}'
------------------------------
Date: Mon, 21 Aug 2000 15:02:18 +0100
From: "Nick Allen" <nick.allen@tbwa-europe.com>
Subject: Generating a directory list...
Message-Id: <8nrca8$pdr$1@soap.pipex.net>
While IIS will allow guests to browse a directory for it's contents, this is
obviously dynamic and the generated page is therefore not customisable.
I'm trying to write some perl which will read the directory and generate a
web page on the fly.
It needs to add in the appropriate hyperlink, ie:
1) a file should link to that file
2) a directory should link to the same script but with a new paramater
telling the script to generate a list for that subdirectory.
Hope that made sense.
I'm an absolute beginner at this but have managed to get as far as creating
the array of filenames together with filesizes etc. What I'm stuck on is how
to work out whether a directory entry is a directory or a file. I figure it
has something to do with the file mode paramter returned by stat but as I'm
unfamiliar with unix I'm getting a bit stuck. I'd persevere on my own but a
little nudge in the right direction could help a lot.
Other than pointing out how much of an amateur I am, does anyone have any
constructive comments / criticism?
1) Is there a library which does much of this - e.g provides a function
called isdirectory or isfile or something?
2) Would I be better off using something other than perl.
etc etc.
TIA
Nick.
------------------------------
Date: Tue, 22 Aug 2000 00:27:54 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Generating a directory list...
Message-Id: <slrn8q2f3a.uou.mgjv@martien.heliotrope.home>
On Mon, 21 Aug 2000 15:02:18 +0100,
Nick Allen <nick.allen@tbwa-europe.com> wrote:
>
> 1) a file should link to that file
> 2) a directory should link to the same script but with a new paramater
> telling the script to generate a list for that subdirectory.
>
> Hope that made sense.
>
> I'm an absolute beginner at this but have managed to get as far as creating
> the array of filenames together with filesizes etc. What I'm stuck on is how
> to work out whether a directory entry is a directory or a file. I figure it
You want to have a look at the perl operators that start with '-', and
that can be found on the perlfunc documentation, either in the HTML
stuff that comes with ActiveState or via perldoc
# perldoc -f -X
(on some older versions of perldoc this won't work, and you'll have to
do
# perldoc perlfunc
and page down)
You'll be most interested in the -d and -f, and maybe in -r as well. I
am not entirely certain how many of these things translate to Win32 file
systems, where some of the documented attributes are meaningless, but
others are available that Unix file systems don't provide.
> has something to do with the file mode paramter returned by stat but as I'm
> unfamiliar with unix I'm getting a bit stuck. I'd persevere on my own but a
> little nudge in the right direction could help a lot.
You could use stat, but I'd just go for the -d and -f operators. Stat
only becomes useful when you need more information.
However.... How did you get the file size? Via stat? ou do already have
the file type then.. in the third field returned.
I still wouldn't use it. I suggest that you read
# perldoc -f stat
where you'll find examples of how to do this with the -d operator
without having to make a second call to stat.
[snip]
if (-x $file && (($d) = stat(_)) && $d < 0) {
print "$file is executable NFS file\n";
}
[snip]
In your case you could do something like
use strict;
my $directory = '/tmp';
opendir(DIR, $directory) or die "Couldn't opendir $directory: $!";
foreach my $file (readdir DIR)
{
my @stat = stat("$directory/$file");
if (-d _)
{
# it's a directory
}
elsif (-f _)
{
# it's a file ($stat[7] contains the size)
}
else
{
# Are there others on win32?
}
}
closedir DIR;
If you want to use the Fcntl macros and constants (as described by the
stat documentation):
use Fcntl qw/:mode/;
# instead of -d
if (S_ISDIR($stat[2]))
# -f
if (S_ISREG($stat[2]))
etc..
It's up to you which one of these two you want to use. Both are readable
enough, and execution speed will barely differ. Startup speed may be
slightly slower for the Fcntl, but I'm not even sure of that.
(and yes, the forward slash works fine on Win32).
> 1) Is there a library which does much of this - e.g provides a function
> called isdirectory or isfile or something?
the -X operators do this sort of stuff, yes.
> 2) Would I be better off using something other than perl.
Not at all :) For this sort of work you can hardly beat Perl :)
Martien
--
Martien Verbruggen |
Interactive Media Division | If at first you don't succeed, try
Commercial Dynamics Pty. Ltd. | again. Then quit; there's no use
NSW, Australia | being a damn fool about it.
------------------------------
Date: Mon, 21 Aug 2000 14:52:51 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Getting rid of extra spaces and returns
Message-Id: <7asnryis3g.fsf@merlin.hyperchip.com>
Bob Tenor <bob3434@excite.com> writes:
> Thanks for the reply - this got rid of extra spaces but it did not get
> rid of extra returns
>
> $name = $formdata{'name'};
> $name =~ tr/\n //s;
>
> Is their another function that I need to implement?
It will get rid of extra returns only iff the returns are
consecutive. If you have other spaces between the returns it won't
work.
Maybe you want:
s/\n\s*\n/\n/g;
?
--Ala
------------------------------
Date: 21 Aug 2000 14:33:04 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Hash List Comparing
Message-Id: <slrn8q2fbn.tj3.abigail@alexandra.foad.org>
ScapS (ScapS@dds.nl) wrote on MMDXLVII September MCMXCIII in
<URL:news:39a1172a.256561571@news.iae.nl>:
:) Hi, is there anybody out there who can help me out??
:)
:) I'd really like to know how I can use an expression to see
:) if a key/pair value in a hash exists.
:)
:) An example will make it a lot clearer I guess =))
:) so here it comes:
:)
:) I fill a hash with input from a User
:) But the User should fill at least the first 4 fields:
:) %hash=( "A" , "anton" , "B" , "ben" , "C","conrad", "D" , "donald" ,
:) "E", "");
:)
:) Or the first 4 fields must be empty
:) %hash=("A" , "" , "B" , "" , "C", "" , "D" , "" , "E",
:) "doesnt_matter");
No, you example does not make it clearer. Your example contradicts the
description what you want. In the latter hash, *all* key/value pairs
exist. It's not clear what you want to check for. Is it the non-existance,
or the fact the value is the empty string?
You probably want to use grep in scalar context, but I don't know what
you want to check for.
Abigail
--
perl -wle '$, = " "; sub AUTOLOAD {($AUTOLOAD =~ /::(.*)/) [0];}
print+Just (), another (), Perl (), Hacker ();'
------------------------------
Date: Mon, 21 Aug 2000 14:44:08 GMT
From: j355@my-deja.com
Subject: Re: Help with quotewords
Message-Id: <8nrf7i$feu$1@nnrp1.deja.com>
I have the same problem, except I've got a work around. One that I
hate, but it works.
The problem is when I get data from a client it may be in a CSV file
like this:
BRIAN O'NEIL, "123 MAIN ST, APT 5", ANY CITY, GA, 30313
Note that the first field contains a single quote and the second field
is quoted. This is one of the cleaner examples of the data I get. The
real world sucks, eh?
If you run this into ParseWords it will choke on the single quote.
So what I do before I call ParseWords is I do a s/\'/\\'/g on each line
to escape the single quote. ParseWords reuturns the unescaped single
quote when you specify the "keep" option.
I would love to find a cleaner solution! Anybody?
In article <8msqpo$h42$1@nnrp1.deja.com>,
troylachinski@my-deja.com wrote:
> I am working on a data conversion program. The following code works
> properly EXCEPT when $plu_descriptor contains a single quote (').
When
> this is the case all variables are empty.
>
> Sample code:
>
> use Text::ParseWords;
> while(<OLD>) { # read a line from file IN into $_
> ($plu_number, $dept, $plu_descriptor, $nothing1,
> $price1) = quotewords(",",0,$_);
> print NEW "$plu_number - $dept - $plu_descriptor - $nothing1 -
> $price1";
>
> Thanks in advance for the help!
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 21 Aug 2000 14:38:24 GMT
From: abigail@foad.org (Abigail)
Subject: Re: HELP: TEXTAREA field and newlines
Message-Id: <slrn8q2fln.tj3.abigail@alexandra.foad.org>
David Efflandt (efflandt@xnet.com) wrote on MMDXLVII September MCMXCIII
in <URL:news:slrn8q1bpm.9ae.efflandt@efflandt.xnet.com>:
::
:: I can confirm that. Even though Unix systems typically end text lines
:: with a newline, textarea lines from Linux Netscape posted to a Unix
:: system end with CR-LF.
Well, of course. First, both Unix, Windows and MacOS end their text lines
with a newline. A newline is a logical symbol - it's the physical bytes
that differ. Perhaps you mean that Unix systems use linefeeds.
But they only use that for text *files*. HTML forms in browsers typically
don't write to files, but are using a network protocol. The standard
newline in network protocols is CR LF, including HTTP. Regardless of
which platform talks to which.
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: Mon, 21 Aug 2000 22:33:51 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: how to generate unreadable from readable perl code
Message-Id: <slrn8q28de.uou.mgjv@martien.heliotrope.home>
On 21 Aug 2000 11:48:29 -0000,
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> Martien Verbruggen <mgjv@tradingpost.com.au> wrote in comp.lang.perl.misc:
> >On 21 Aug 2000 10:15:20 -0000,
> > Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> >> Martien Verbruggen <mgjv@tradingpost.com.au> wrote in comp.lang.perl.misc:
> >>
> >> >If that's all you want to do, and you control the source you need to
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^
> >> >transform: It's trivial to write that.
> >>
> >> The way I understand the OP, he wants a program that finds and replaces
> >> all identifiers in a Perl source. It would have to understand that
> >> "tr%hash%HASH%" doesn't refer to the variable "%hash". Far from trivial.
> >
> >I underlined a crucial part of my remark. I know fully well that parsing
> >Perl source in general is hard. However, _if_ you want to obfuscate
> >variables, you can write the code in such a way that it is easily
> >parseable. And you can do so without much trouble. Perl is hard to parse
> >because it allwos so many things. In real life code very few of the hard
> >to parse things occur.
>
> So you're saying there is a set of rules such that if a Perl source
> is written accordingly it it easy to (for instance) recognize all
> Perl identifiers and skip identical strings that aren't identifiers?
> Not to speak of other requirements, like comment parsing, recognition
> of quoted text, etc....
I said that in the context of _this_ thread, where the only mentioned
requirement was that variable names needed to be changed to something
silly, and proviso that the code is maintained by the same people who
write the obfuscator, that it would be simple enough to do this. I
didn't see requirements for comment parsing. And yes, it would be
necessary to do some things for single quoted strings, and one would
need to make sure to distinguis scalars from array elements, but that
can all be done if the OP still thinks it's worth it.
I wouldn't even go near such a project, but it's definitely not
undoable, given the restrictions.
Whether that translates to 'a given set of rules' I do not want to
commit to. Some things may need iteration between obfuscation and
rewrite of the code. One of the reasons why I wouldn't even go near it
with a ten foot pole. Too dangerous. Might introduce bugs. Everyhting
needs to be tested twice. But I already stated early on that I didn't
believe this whole thing was worth it.
> >Besides, anyone who uses %, @ or $ as a separator for s///, tr///, m//
> >or qq and related operators, should be taken outside behind the shed,
> >and summarily shot :)
>
> Well, that might become one of the rules. How many others are there?
> My guts feeling is, you'll end up with a set of rules that make it
> very hard to code something meaningful without getting shot.
I don't think so. I even expect that I could probably write a reasonably
successful parser that could deal with the code that _I_ wrote myself.
Simply because I tend to avoid difficult syntax, and almost always
disambiguate things, just for my internal parser's benefit. There will
still be places in my code that that parser will fail on, and that I'd
probably want to change in the code as opposed to extending the parser.
But again: I know that nothing can parse Perl but perl. I know that this
whole exercise is futile and nonsensical. I wouldn't _want_ to impose
any set of rules on anyone. But anyone silly enough to want to obfuscate
variable names in Perl code might very well want to.
Martien
--
Martien Verbruggen |
Interactive Media Division | I'm just very selective about what I
Commercial Dynamics Pty. Ltd. | accept as reality - Calvin
NSW, Australia |
------------------------------
Date: 21 Aug 2000 13:18:14 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: how to generate unreadable from readable perl code
Message-Id: <8nra6m$ulg$1@lublin.zrz.tu-berlin.de>
Martien Verbruggen <mgjv@tradingpost.com.au> wrote in comp.lang.perl.misc:
[...]
>But again: I know that nothing can parse Perl but perl. I know that this
>whole exercise is futile and nonsensical. I wouldn't _want_ to impose
>any set of rules on anyone. But anyone silly enough to want to obfuscate
>variable names in Perl code might very well want to.
I would suggest to agree to disagree on whether this set of rules is
feasible. But since we agree the whole plan is disagreeable, I won't.
Anno
------------------------------
Date: 21 Aug 2000 14:20:07 GMT
From: abigail@foad.org (Abigail)
Subject: Re: how to generate unreadable from readable perl code
Message-Id: <slrn8q2ej8.tj3.abigail@alexandra.foad.org>
Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMDXLVII
September MCMXCIII in <URL:news:8nr4ud$ugb$1@lublin.zrz.tu-berlin.de>:
\\
\\ So you're saying there is a set of rules such that if a Perl source
\\ is written accordingly it it easy to (for instance) recognize all
\\ Perl identifiers and skip identical strings that aren't identifiers?
\\ Not to speak of other requirements, like comment parsing, recognition
\\ of quoted text, etc....
Well, yes, I think it's trivial to program Perl in such a way that any
substring that consists of '$', '@', '%' followed by an identifier, but
not preceded by a backslash, is a variable, and that all variables are
written that way. It's also trivial to write Perl such that any occurance
of a '#' that does not start a comment is proceeded by a backslash.
If your source follows these simple rules, to do what the OP wants doesn't
require you to parse comments or recognize quoted text.
You even don't have to distinguish between a scalar and an array index.
Just map both `$foo' and `@foo' onto `$V0001' and `@V0001'.
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: 21 Aug 2000 14:22:41 GMT
From: abigail@foad.org (Abigail)
Subject: Re: how to generate unreadable from readable perl code
Message-Id: <slrn8q2eo9.tj3.abigail@alexandra.foad.org>
Rafael Garcia-Suarez (rgarciasuarez@free.fr) wrote on MMDXLVII September
MCMXCIII in <URL:news:slrn8q263c.5u1.rgarciasuarez@rafael.kazibao.net>:
^^ Anno Siegel wrote in comp.lang.perl.misc:
^^ >
^^ >The way I understand the OP, he wants a program that finds and replaces
^^ >all identifiers in a Perl source. It would have to understand that
^^ >"tr%hash%HASH%" doesn't refer to the variable "%hash". Far from trivial.
^^
^^ Even removing comments is non-trivial:
^^ s#\#.*$##;# does not work
But it's trivial to write your code in such a way that
s/(^|[^\\])#.*//;
*does* work.
Abigail
--
perl -we 'eval {die ["Just another Perl Hacker\n"]}; print ${${@}}[$#{@{${@}}}]'
------------------------------
Date: Tue, 22 Aug 2000 00:00:47 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: how to generate unreadable from readable perl code
Message-Id: <slrn8q2dgf.uou.mgjv@martien.heliotrope.home>
On 21 Aug 2000 13:18:14 -0000,
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> Martien Verbruggen <mgjv@tradingpost.com.au> wrote in comp.lang.perl.misc:
>
> [...]
>
> >But again: I know that nothing can parse Perl but perl. I know that this
> >whole exercise is futile and nonsensical. I wouldn't _want_ to impose
> >any set of rules on anyone. But anyone silly enough to want to obfuscate
> >variable names in Perl code might very well want to.
>
> I would suggest to agree to disagree on whether this set of rules is
> feasible. But since we agree the whole plan is disagreeable, I won't.
{grok, grok}
I agree to the suggestion to agree to disagree about the ruleset
feasability. The disagreeability of the plan is agreed upon, and the
thread is closed for submissions.
All rise.
Martien
--
Martien Verbruggen |
Interactive Media Division | That's funny, that plane's dustin'
Commercial Dynamics Pty. Ltd. | crops where there ain't no crops.
NSW, Australia |
------------------------------
Date: 21 Aug 2000 14:39:47 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: how to generate unreadable from readable perl code
Message-Id: <8nrevj$uq6$1@lublin.zrz.tu-berlin.de>
Abigail <abigail@foad.org> wrote in comp.lang.perl.misc:
>Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMDXLVII
>September MCMXCIII in <URL:news:8nr4ud$ugb$1@lublin.zrz.tu-berlin.de>:
>\\
>\\ So you're saying there is a set of rules such that if a Perl source
>\\ is written accordingly it it easy to (for instance) recognize all
>\\ Perl identifiers and skip identical strings that aren't identifiers?
>\\ Not to speak of other requirements, like comment parsing, recognition
>\\ of quoted text, etc....
>
>Well, yes, I think it's trivial to program Perl in such a way that any
>substring that consists of '$', '@', '%' followed by an identifier, but
>not preceded by a backslash, is a variable, and that all variables are
>written that way. It's also trivial to write Perl such that any occurance
>of a '#' that does not start a comment is proceeded by a backslash.
Okay, fortunately for that claim $#array and $# aren't really needed.
What if $# becomes interesting again? What about $$? Symrefs are out,
you can't rename a variable that's accessed via ${ $x.$y}.
Did I hear someone say "use English"?
Despite my nagging, I think your two rules cover a lot of ground,
far more than I thought could be covered with something simple like
that.
Anno
------------------------------
Date: Mon, 21 Aug 2000 13:54:59 +0100
From: "Paul McClean" <pmcclean@nortelnetworks.com>
Subject: Re: HTML
Message-Id: <8nr8r4$j15$1@bcrkh13.ca.nortel.com>
Yep, been done many times before.
Check out http://www.ora.com/openbook/webclient/
for a good discussion of implementation using perl.
Regards,
Paul
"If at first you don't suceed, destroy any evidence that you tried"
Antony <mcnultya@NOSPAMnortelnetworks.com> wrote in message
news:8nqvqr$sl1$1@qnsgh006.europe.nortel.com...
> Hi,
>
> Is there a way to retrieve an HTML file from a location on the web using
PERL?
>
> I want to write a perl script to get this information and extract parts of
it to update a local DB.
>
> Cheers in advance,
>
> Antony
>
------------------------------
Date: 21 Aug 2000 14:42:14 GMT
From: abigail@foad.org (Abigail)
Subject: Re: join on two arrays
Message-Id: <slrn8q2fsv.tj3.abigail@alexandra.foad.org>
peter pilsl (pilsl@goldfisch.atat.at) wrote on MMDXLVII September
MCMXCIII in <URL:news:MPG.140aa21f3695b50398984d@news.chello.at>:
))
)) what I have:
)) @fruits=('apple','cherry');
)) @color=('green','red');
))
)) And I want the following output:
))
)) 'The apple is green. The cherry is red'
))
)) Possible without an explicit loop ?
With no loop? Easy:
print "The apple is green. The cherry is red";
HTH. HAND.
Abigail
--
$" = "/"; split $, => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_) {print "$_ $_{$_} "}};
%{"@_"} = %_ = (Just => another => Perl => Hacker); &{%{%_}};
------------------------------
Date: Mon, 21 Aug 2000 13:34:17 GMT
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: New posters to comp.lang.perl.misc
Message-Id: <sq2bup4h87v36@corp.supernews.com>
Following is a summary of articles from new posters spanning a 7 day
period, beginning at 14 Aug 2000 14:36:32 GMT and ending at
21 Aug 2000 14:18:14 GMT.
Notes
=====
- A line in the body of a post is considered to be original if it
does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
- All text after the last cut line (/^-- $/) in the body is
considered to be the author's signature.
- The scanner prefers the Reply-To: header over the From: header
in determining the "real" email address and name.
- Original Content Rating (OCR) is the ratio of the original content
volume to the total body volume.
- Find the News-Scan distribution on the CPAN!
<URL:http://www.perl.com/CPAN/modules/by-module/News/>
- Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
- Copyright (c) 2000 Greg Bacon.
Verbatim copying and redistribution is permitted without royalty;
alteration is not permitted. Redistribution and/or use for any
commercial purpose is prohibited.
Totals
======
Posters: 216 (43.9% of all posters)
Articles: 358 (21.3% of all articles)
Volume generated: 612.3 kb (20.5% of total volume)
- headers: 271.1 kb (5,550 lines)
- bodies: 328.9 kb (11,422 lines)
- original: 247.2 kb (8,928 lines)
- signatures: 11.9 kb (271 lines)
Original Content Rating: 0.752
Averages
========
Posts per poster: 1.7
median: 1.0 post
mode: 1 post - 156 posters
s: 2.8 posts
Message size: 1751.3 bytes
- header: 775.5 bytes (15.5 lines)
- body: 940.8 bytes (31.9 lines)
- original: 707.1 bytes (24.9 lines)
- signature: 33.9 bytes (0.8 lines)
Top 10 Posters by Number of Posts
=================================
(kb) (kb) (kb) (kb)
Posts Volume ( hdr/ body/ orig) Address
----- -------------------------- -------
37 89.0 ( 30.3/ 51.5/ 34.0) mgjv@tradingpost.com.au
9 11.4 ( 8.0/ 2.9/ 1.9) Alex Buell <alex.buell@tahallah.clara.co.uk>
8 15.2 ( 5.5/ 9.6/ 5.7) "Dale Emmons" <dale@emmons.dontspamme.com>
6 9.4 ( 4.5/ 4.9/ 3.4) "Lincoln Marr" <lincolnmarr@nospam.europem01.nt.com>
5 10.3 ( 3.3/ 7.0/ 5.1) Jonas Reinsch <Jonas.Reinsch@ppi.de>
4 5.8 ( 2.7/ 3.1/ 2.2) pape_98@my-deja.com
4 5.1 ( 2.2/ 2.9/ 2.9) "Lithium" <lithium@ev1.net>
4 7.9 ( 3.3/ 4.0/ 2.3) Ilmari Karonen <usenet11190@itz.pp.sci.fi>
4 5.9 ( 2.8/ 3.1/ 2.7) "pete" <pete@alphanetcoms.co.uk>
4 6.2 ( 3.5/ 2.7/ 1.8) Sandra <sandra@siliconrack.com>
These posters accounted for 5.1% of all articles.
Top 10 Posters by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Address
-------------------------- ----- -------
89.0 ( 30.3/ 51.5/ 34.0) 37 mgjv@tradingpost.com.au
15.2 ( 5.5/ 9.6/ 5.7) 8 "Dale Emmons" <dale@emmons.dontspamme.com>
14.9 ( 1.7/ 13.2/ 12.3) 2 "Rob" <rsouthgate@hotmail.com>
11.4 ( 8.0/ 2.9/ 1.9) 9 Alex Buell <alex.buell@tahallah.clara.co.uk>
10.3 ( 3.3/ 7.0/ 5.1) 5 Jonas Reinsch <Jonas.Reinsch@ppi.de>
9.4 ( 4.5/ 4.9/ 3.4) 6 "Lincoln Marr" <lincolnmarr@nospam.europem01.nt.com>
8.6 ( 2.5/ 6.1/ 1.9) 3 newsgroup@here.com
7.9 ( 3.3/ 4.0/ 2.3) 4 Ilmari Karonen <usenet11190@itz.pp.sci.fi>
7.0 ( 2.7/ 4.3/ 2.7) 3 "Mark Neill" <unixgod@jacksonville.net>
6.7 ( 2.2/ 4.5/ 1.3) 3 j355@my-deja.com
These posters accounted for 6.0% of the total volume.
Top 10 Posters by OCR (minimum of three posts)
==============================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
1.000 ( 1.5 / 1.5) 3 marxjkj123@my-deja.com
1.000 ( 2.6 / 2.6) 3 "Dave" <superman183@hotmail.com>
1.000 ( 2.9 / 2.9) 4 "Lithium" <lithium@ev1.net>
0.992 ( 4.5 / 4.5) 3 musicfan <musicfan@punitiveart.com>
0.922 ( 1.8 / 1.9) 3 zideon@my-deja.com
0.875 ( 2.7 / 3.1) 4 "pete" <pete@alphanetcoms.co.uk>
0.843 ( 3.5 / 4.2) 3 Scott Kirk <undergronk@my-deja.com>
0.752 ( 1.9 / 2.5) 3 Uwe Doetzkies <Uwe.Doetzkies@Dresdner-Bank.com>
0.723 ( 5.1 / 7.0) 5 Jonas Reinsch <Jonas.Reinsch@ppi.de>
0.713 ( 2.2 / 3.1) 4 pape_98@my-deja.com
Bottom 10 Posters by OCR (minimum of three posts)
=================================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
0.620 ( 2.7 / 4.3) 3 "Mark Neill" <unixgod@jacksonville.net>
0.594 ( 5.7 / 9.6) 8 "Dale Emmons" <dale@emmons.dontspamme.com>
0.580 ( 2.3 / 4.0) 4 Ilmari Karonen <usenet11190@itz.pp.sci.fi>
0.543 ( 2.1 / 4.0) 3 akdwivedi@hotmail.com
0.472 ( 1.9 / 4.0) 3 kingofkingston@my-deja.com
0.429 ( 1.4 / 3.4) 3 "Graham Chapman" <g.chapman0749@home.com>
0.407 ( 1.0 / 2.4) 3 srikdvs@my-deja.com
0.347 ( 1.3 / 3.9) 3 jamesk5674@my-deja.com
0.309 ( 1.9 / 6.1) 3 newsgroup@here.com
0.285 ( 1.3 / 4.5) 3 j355@my-deja.com
27 posters (12%) had at least three posts.
Top 10 Targets for Crossposts
=============================
Articles Newsgroup
-------- ---------
18 comp.lang.perl
14 alt.perl
9 comp.lang.perl.modules
6 comp.mail.misc
5 comp.lang.perl.tk
3 comp.os.linux.misc
3 de.comp.lang.perl.misc
3 de.comp.lang.perl.cgi
3 comp.mail.sendmail
2 news.answers
Top 10 Crossposters
===================
Articles Address
-------- -------
6 "Alexander" <thewarehouse@europe.com>
4 Astrid Behrens <behrens@haulpak.com>
2 prasanth Mudundi <pmudundi@gis.net>
2 Jerry Russell <jerry@kachinaguide.com>
2 "J. Strübig" <struebig@mail.uni-mainz.de>
2 newdebugger@my-deja.com
2 Steve Martin <stevem@rt66.com>
2 jon_nixon@my-deja.com
2 "Gary Brown" <garyb1@home.com>
2 "Stefan Soller" <Stefan.Soller@gmx.ch>
------------------------------
Date: Tue, 22 Aug 2000 00:29:25 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: New posters to comp.lang.perl.misc
Message-Id: <slrn8q2f65.uou.mgjv@martien.heliotrope.home>
On Mon, 21 Aug 2000 13:34:17 GMT,
Greg Bacon <gbacon@cs.uah.edu> wrote:
> Following is a summary of articles from new posters spanning a 7 day
[snip]
> 37 89.0 ( 30.3/ 51.5/ 34.0) mgjv@tradingpost.com.au
Hey! Is it _my_ fault that my company decides to change the external
email addresses?
:)
Martien
--
Martien Verbruggen |
Interactive Media Division | Failure is not an option. It comes
Commercial Dynamics Pty. Ltd. | bundled with your Microsoft product.
NSW, Australia |
------------------------------
Date: Mon, 21 Aug 2000 23:39:29 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Opening new processes...
Message-Id: <slrn8q2c8h.uou.mgjv@martien.heliotrope.home>
On Mon, 21 Aug 2000 08:33:18 -0400,
Dave <superman183@hotmail.com> wrote:
>
> The scripts are probably not too processor intensive, since each one would
> only be going off and grabbing an html page from a predefined site, (each
> script = one different site), and then the parent process would wait few
> seconds and process the files retrieved, so I guess that running them
> simultaneously would have some good time benefits probably.
In that case, yes, it will definitely be beneficial. Remote network
accesses are almost always better done in parallel (given a speedy
connection). Another good example of beneficial parallellisation is bulk
DNS lookups. Even if the documents came from the same site, you'd
probably benefit, because most remote connections have high latency,
even over high speed networks.
Martien
--
Martien Verbruggen |
Interactive Media Division | In a world without fences, who needs
Commercial Dynamics Pty. Ltd. | Gates?
NSW, Australia |
------------------------------
Date: Mon, 21 Aug 2000 23:41:10 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Opening new processes...
Message-Id: <slrn8q2cbm.uou.mgjv@martien.heliotrope.home>
On 21 Aug 2000 12:44:12 -0000,
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> Martien Verbruggen <mgjv@tradingpost.com.au> wrote in comp.lang.perl.misc:
>
> >It all depends on what these individual scripts do. If they are all very
> >CPU intensive, or if they all very heavily read or write to the same
[snip]
>
> It also depends on what else is happening on the machine. If you
> are competing for resources, forking more processes can increase
> your share (some may say, unfairly).
Indeed. And I have worked in environments where people taking more than
their share would find their jobs killed :). Not that I would ever do
that.. I mean... I really wouldn't...
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: 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 4080
**************************************