[17653] in Perl-Users-Digest
Perl-Users Digest, Issue: 5073 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Dec 9 18:05:36 2000
Date: Sat, 9 Dec 2000 15:05:11 -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: <976403111-v9-i5073@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 9 Dec 2000 Volume: 9 Number: 5073
Today's topics:
Re: ($fastest) ? "perl_on_Linux" : "perl_on_Windows" <bowman@montana.com>
Re: Algorithm::Diff -- why does diff() return LOLOL ins <iltzu@sci.invalid>
Re: Anywhere to put my scripts? (Fryar386)
Calling PERL from PERL <nospan@spamcity.com>
Re: Calling PERL from PERL <dave@dave.org.uk>
CHMOD (Fryar386)
coloured text? <SiStie@wastie.de>
Re: coloured text? <tony_curtis32@yahoo.com>
Console use of Ruby/Perl compared to REBOL <brannon@lnc.usc.edu>
Re: eval() performance <spam@klamath.dyndns.org>
Re: FAQ 4.57: How do I sort a hash (optionally by val <uri@sysarch.com>
Re: HELP PLEASE! (Fryar386)
Image::Magick docs <jhiller@online-testing.net>
Lured by JSP. Limited study time. Need guru to argue Pe <garry@heaton6.freeserve.co.uk>
lwp <ng@fnmail.com>
problem with script (Fryar386)
Re: Profanity Check <habfan2@my-deja.com>
Re: Protecting my Perl script? <iltzu@sci.invalid>
Reading from a file peterkelley@my-deja.com
Shared Memory <caryz@hotmail.com>
Re: Statistics for comp.lang.perl.misc (Philip 'Yes, that's my address' Newton)
substitution regexp <onthebog@hotmail.com>
Re: substitution regexp (Chris Fedde)
Re: substitution regexp <krahnj@acm.org>
Re: substitution regexp <uri@sysarch.com>
Re: Translate pixel colors into hex codes <bwalton@rochester.rr.com>
Re: Translate pixel colors into hex codes <eager@curious.com>
Re: Translate pixel colors into hex codes <bwalton@rochester.rr.com>
Using guestbookscript for printing labels. <fabianos@telia.com>
Re: Why isn't Perl highly orthogonal? (Daniel Chetlin)
Re: Why isn't Perl highly orthogonal? <thelma@alpha2.csd.uwm.edu>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 9 Dec 2000 09:04:32 -0700
From: "bowman" <bowman@montana.com>
Subject: Re: ($fastest) ? "perl_on_Linux" : "perl_on_Windows"
Message-Id: <KOsY5.527$XY.10801@newsfeed.slurp.net>
<theredviper@my-deja.com> wrote
>
> Thanks for the response. I use perl on Windows NT and Redhat Linux 6.2
> at work and I was surprised by the better performance on Linux than NT
> although the NT machine was much much beefier.
It is not only Perl. I work with a large, complex app that was developed on
*nix
and ported to NT using mks as a buffer. While one would expect the Motif
GUIs
to take a performance hit, even the non-GUI processes are sluggish. A 750
mhz
dual processor NT box feels slower than a 200 mhz RH6.0 box.
------------------------------
Date: 9 Dec 2000 17:56:42 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Algorithm::Diff -- why does diff() return LOLOL instead of LOL?
Message-Id: <976384031.4483@itz.pp.sci.fi>
In article <3a31e100.5d00$b2@news.op.net>, Mark-Jason Dominus wrote:
>In article <976317794.25617@itz.pp.sci.fi>,
>Ilmari Karonen <usenet11299@itz.pp.sci.fi> wrote:
>>In article <iowa88_song88.remove_eights-0812001312100001@121.salt-lake-city-08-09rs.ut.dial-access.att.net>, Weston Cann wrote:
>>>I'm looking at the documentation about Algorithm::Diff, and I don't
>>>quite get why the list returned from diff is a list of lists of lists,
>>>rather than simply a list of lists. For the example:
>>
>>Presumably because the original author (MJD) wanted it that way.
>
>I hope this doesn't sound nasty, but I think that is a very poor
>answer, because it answers nothing: "Why did MJD want it that way, then?"
No offense taken. My point was simply that diff() is just a fairly
simple wrapper around traverse_sequences(), and if the OP felt that
some other format was more useful to them, they could have it their
way. TIMTOWTDI.
That, and showing that there's nothing to fear about closures.
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post
something, we discuss its implications. If the discussion happens to
answer a question you've asked, that's incidental." -- nobull in clpm
------------------------------
Date: 09 Dec 2000 23:03:34 GMT
From: fryar386@aol.com (Fryar386)
Subject: Re: Anywhere to put my scripts?
Message-Id: <20001209180334.19852.00003383@ng-ft1.aol.com>
>>yourscripts | /dev/null ?
>>
>Data written on a null or zero special file is discarded.
>
>./program.pl > /tmp/gooddata.txt 2> /dev/null
>
>Just don't fill it all the way up!
>
>--
> Richard Zilavec
> rzilavec@tcn.net
>
>
Well guys, I kind of meant a whole new server
Thanks
------------------------------
Date: Sat, 9 Dec 2000 17:28:30 -0000
From: "Neil Thompson" <nospan@spamcity.com>
Subject: Calling PERL from PERL
Message-Id: <t34qfs731i118b@corp.supernews.co.uk>
OK, I give in. I can't find the answer to this. Is it possible to call one
perl program from another passing paramters? Is it the eval command?
Help appreciated.
Thanks,
Neil.
--
--------------------------------
Web Site: www.neilthompson.co.uk
--------------------------------
------------------------------
Date: Sat, 09 Dec 2000 17:39:22 +0000
From: Dave Cross <dave@dave.org.uk>
Subject: Re: Calling PERL from PERL
Message-Id: <3A326E4A.4671615F@dave.org.uk>
Neil Thompson wrote:
> OK, I give in. I can't find the answer to this. Is it possible to call one
> perl program from another passing paramters? Is it the eval command?
Depending on what exactly you want to do, you'd use system, exec or the qx//
operator.
Cheers,
Dave...
------------------------------
Date: 09 Dec 2000 23:01:15 GMT
From: fryar386@aol.com (Fryar386)
Subject: CHMOD
Message-Id: <20001209180115.19852.00003382@ng-ft1.aol.com>
What CHMODE should I have to write files to a directory? And could someone
please give me a list of all the CHMODES I always forget them
Thanks
------------------------------
Date: Sat, 9 Dec 2000 20:57:18 +0100
From: Simon Stiefel <SiStie@wastie.de>
Subject: coloured text?
Message-Id: <Pine.LNX.4.21.0012092055590.1221-100000@server.stiefel.priv>
Hi,
how can I write coloured text with perl??
Any hints?
with best regards
Simon Stiefel
--
|Simon Stiefel | Zwerbachstrasse 17 | 72555 Metzingen-Glems | Germany |
|SimonStiefel@wastie.de | http://www.wastie.de | ICQ-UIN: 20196644 |
|phone: +497123/379070 | fax: +49179/335990106 | cell: +49179/5990106 |
|Tux#: 114751 | PingoS - Linux-User helfen Schulen | Powered by LiNUX |
------------------------------
Date: 09 Dec 2000 14:38:53 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: coloured text?
Message-Id: <87aea5gwiq.fsf@limey.hpcc.uh.edu>
>> On Sat, 9 Dec 2000 20:57:18 +0100,
>> Simon Stiefel <SiStie@wastie.de> said:
> Hi, how can I write coloured text with perl??
Term::ANSIColor
hth
t
--
Eih bennek, eih blavek.
------------------------------
Date: Sat, 09 Dec 2000 20:56:24 GMT
From: Terrence Brannon <brannon@lnc.usc.edu>
Subject: Console use of Ruby/Perl compared to REBOL
Message-Id: <lbaea5mhzf.fsf@lnc.usc.edu>
I dont know if there is a way to make the perfect language for
everything. I really wish Ruby had been around before Perl. I love
it's exception hierarchy. I like the regularity of method access. I
like how easy it is to overload things. I like how easy it is to
serialize things. Also, some very mind-numbing things in Perl such as
server/client programs are available in Ruby already.
Furthermore, the Ruby experts are not nearly as snobbish or as elitist
as most of the major Perl experts --- just read comp.lang.perl.misc
for a week or two if you don't believe me.
Any, time to show how REBOL is easier than Ruby for console access:
--- get a url:
print read http://www.ruby-lang.org
The Ruby interpretation of this is
require 'net/http'
h = Net::HTTP::new('www.ruby-lang.org', 80);
resp, msg = h.get('/', nil)
puts resp
The Perl implementation is
use LWP::Simple;
print get 'http://www.ruby-lang.org';
or, with my Perl REBOL classes:
REBOL::url->new('http://ruby-lang.org')->GET->PRINT;
But, still, the Perl/Ruby code will never be intuitive to the non-technical
architect. And so we have computer application architects unable to
actually implement the top-level design of large complex systems
because they find the non-english nature of Ruby and Perl
unintuitive. Either that or the implementation is as non-English-like
as the things above.
Sending email in REBOL is also much simpler than Ruby or Perl:
send princepawn@yahoo.com "how dare you criticize my favourite
language!"
And we are done. "Overload" the send command and we can couple
together two CORBA architectures with a single line of REBOL.
Does a language such as this have its shortcomings? Possibly. First,
argument presentation can become confusing
add to-number! read url 5
will add 5 to the number read from a url, but the 5 which relates to
the word "add" is way down the list. This is a simple exmaple, but a
more complex example, could hvbe the five many words down in the
sentence. All of this gets very difficult when dealing with
refinements and keeping track of arguments.
Also, one cannot do keyword based argumentation easily in REBOL as one
can do in Ruby/Perl.
Second, REBOL is very global-oriented. It is very easy to build up a
REBOL program by simply typing away at its console and saving what you
do in little words and then calling up the words later when you need
them. While this is great for non-mission-critical systems, I prefer
the package orientation of Perl along with 'use strict'.
So, we have some principles:
1- Whitespace is a natural separator of items. At least some items,
commas are better for separating list items. However, REBOL opts for
blocks over commas. Example:
apples: [ powerbook ibook mac-classic ]
mac-classic: [ age: 20 weight: 20]
ibook [age: 1 weight: 1]
print mac-classic/age
Again, we see the ease of data specification in REBOL. Even for
something as non-first-class as a catalog of apple computers, they
were introduced without a bunch of stringification because of the
power of new-word introduction.
2- "action-oriented" syntax is more English-like than "object-oriented"
3- REBOL is much easier to use from the shell due to it's English-like
nature and the fact that common "things" (dates, times, URLs, email
addresses) are first-class, meaning they do not require quoting or
explicit typing because the core language expects them.
Console use of Perl and Ruby suffer from the need to create
objects within a domain while REBOL is always ready to accomodate
entry into common domains.
--
Terrence Brannon
------------------------------
Date: Sat, 09 Dec 2000 17:28:06 GMT
From: Neil Conway <spam@klamath.dyndns.org>
Subject: Re: eval() performance
Message-Id: <3A326BA6.5090708@klamath.dyndns.org>
Mark-Jason Dominus wrote:
> Yes, but since it doesn't do the same thing, or anything even close to
> it, changing it probably won't help you with your real problem.
Right - I get it now.
Thanks for the help, Mark et al.
Neil
------------------------------
Date: Sat, 09 Dec 2000 18:37:09 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: FAQ 4.57: How do I sort a hash (optionally by value instead of key)?
Message-Id: <x7elzhl9uy.fsf@home.sysarch.com>
>>>>> "BK" == Ben Kennedy <bkennedy99@home.com> writes:
BK> Yes, I realize that things like this are easily *plonk*-able, but
BK> I try to avoid that sort of thing, especially in this case where
BK> the posts are well-meaning. Besides, even though you can't see
BK> the clutter doesn't mean its not still there. If someone were
BK> posting these FAQ tidbits every 5 minutes, everyone would be up in
BK> arms - I'm just trying to gauge what is generally acceptable.
these are from tom christiansen and were posted this way starting about
2 years ago. there was plenty of debate on whether to do it and how
often. most seem to like the idea and it encourages people to actually
read the FAQ from cover to cover. have YOU (any of you) done that? it
also allows more eyeballs to find mistakes and improvements to the
faq. so just downscore them if you want to skip them. this go round has a
new address and easy to filter format just for that reason. it is only
about 3 posts a day which seems ok volume-wise compared to the hundreds
of others.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 09 Dec 2000 22:26:20 GMT
From: fryar386@aol.com (Fryar386)
Subject: Re: HELP PLEASE!
Message-Id: <20001209172620.02468.00003046@ng-fb1.aol.com>
>Take peek at 'perldoc perlre' and see if it would be easier to come up
>with a regular expression listing "all the symbols like that" (whatever
>'that' might be, since I don't see a pattern), or an expression that just
>retains what you want to keep
I want to make people have their own file when the sign up. But it gives me an
error when I try to create a file with the _ @ ! # $ % ^ & * ( ) = +, so I
wanted to know how to take those out
------------------------------
Date: Sat, 09 Dec 2000 19:06:18 GMT
From: Jordan Hiller <jhiller@online-testing.net>
Subject: Image::Magick docs
Message-Id: <3A328336.1F50939B@online-testing.net>
Hi,
I'm trying to use Image::Magick to simply check an image's size, resize
it, and save it as a different image. It would be nice if I could find
some documentation...the perldoc docs contain basically no information
and the web page help does not work
(http://www.wizards.dupont.com/cristy/www/perl.html). Can someone help
me find some documentation or explain how to read the size of and resize
an image?
Thanks,
Jordan Hiller
http://www.Online-Testing.Net
Online Quiz and Testing Solutions
------------------------------
Date: Sat, 9 Dec 2000 21:34:58 -0000
From: "Garry Heaton" <garry@heaton6.freeserve.co.uk>
Subject: Lured by JSP. Limited study time. Need guru to argue Perl's advantages
Message-Id: <90u8ji$cvk$1@newsg2.svr.pol.co.uk>
I have started learning Perl and really like the language but I have also
begun studying the Java Server Pages and have had some good results with
database-access scripts. Much longer-winded syntax but full access to the
extensive Java API. As I only have limited study time available and need to
learn 1 programming language thoroughly instead of dabbling in 2, I am faced
with the difficult choice of maybe dropping my Perl studies simply because
everywhere I hear about the advantages of the Java/JSP approach
(scalability, server resources, servlet advantages etc.) Haven't heard much
in defence of Perl's advantages over Java. Is there a Perl guru out there
who can put a good case for choosing Perl over the new JSP technology?
I don't want to be political about it. This is a really serious dilemma I'm
facing as my study time is now limited as a result of new commitments.
Thanks
Garry Heaton
------------------------------
Date: Sat, 9 Dec 2000 15:08:37 -0600
From: "Enrico Ng" <ng@fnmail.com>
Subject: lwp
Message-Id: <90u74i$c12$1@info1.fnal.gov>
I dont know if this is possible, but I want to make a script that will login
to my online bank acount and display my balance.
the problem is that the form that is used to login is a asp script.
I tryed just putting ?usename=enricong&password=...
but that didnt work.
any ideas?
--
Enrico Ng <ng@fnmail.com>
------------------------------
Date: 09 Dec 2000 22:42:15 GMT
From: fryar386@aol.com (Fryar386)
Subject: problem with script
Message-Id: <20001209174215.02444.00003022@ng-fb1.aol.com>
Ok, I figured out the problem with my script, I just don't know what it means.
The error is
Bareword "e" not allowed while "strict subs" in use at joinform.cgi line 95.
Unquoted string "e" may clash with future reserved word at joinform.cgi line
95.
Execution of joinform.cgi aborted due to compilation errors.
($health = "100");
($maxhealth = "100");
($intel = "25");
}
#line 95 (I think, it's around here) ($username = $input{'username'});
print "Content-type: text/html\n\n";
open(OUT, ">$username.txt")
or die "Error, Please try later\n";
flock OUT, 2
or die "Couldn't acquire an exclusive lock on test.txt: $!\n";
print OUT <<ENDOFTEXT;
<P>
Username: $input{username}
Password: $input{password}
E-mail: $input{e-mail}
Attacks: $input{basic1}
Main Goal: $input{main_goal}
Planet: $planet
I don't quite know what line is line 95 (sorry, I'm a newbie, and I'm 9), but
I've found the general location. SO could somebody tell me what the error
means and how I can fix it?
------------------------------
Date: Sat, 09 Dec 2000 16:50:25 GMT
From: Teacher Guy <habfan2@my-deja.com>
Subject: Re: Profanity Check
Message-Id: <90tnsh$mqp$1@nnrp1.deja.com>
Thanks to everyone for their input on Profanity Check issue. I'll try
the changes that you have suggested and see if it has any inpact :)
Teacher Guy
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 9 Dec 2000 21:19:30 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Protecting my Perl script?
Message-Id: <976396143.28301@itz.pp.sci.fi>
In article <brian+usenet-243716.08273509122000@news.panix.com>, brian d foy wrote:
>In article <kyjX5.646$n3.8984@news.globetrotter.net>, "Neb"
><berube@odyssee.net> wrote:
>
>> So, beside executables, is there an other way to be able to run the script,
>> but with some encryption of the source code?
>
>it's trivial to deparse Perl, so there's no point in even trying to
>hide the source code.
That reminds me, I should probably go and grab the latest versions of
perl and B::Deparse, and see if I can remember any of the expressions
I've found to tickle bugs in it. There were some rather subtle ones,
such as "sort +foo()".
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post
something, we discuss its implications. If the discussion happens to
answer a question you've asked, that's incidental." -- nobull in clpm
------------------------------
Date: Sat, 09 Dec 2000 22:01:25 GMT
From: peterkelley@my-deja.com
Subject: Reading from a file
Message-Id: <90ua3j$4f2$1@nnrp1.deja.com>
Before I start - I'm a newbie.
How do I read data from a file and put it into a hash? I 'm trying to create
a currency calculator that will read the currency type and rate from a file.
Secondly, can I have a hash with one key and multiple values? For example, I
would like to have a file containing a product ID with values like price,
description, etc. Can I do that? How do I access those values later in the
program? For example, how do I pull out the price of a particular product
ID?
Help would be appreciated!
pk
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 09 Dec 2000 20:52:31 GMT
From: "Cary" <caryz@hotmail.com>
Subject: Shared Memory
Message-Id: <jYwY5.7469$wo2.145463@typhoon.austin.rr.com>
Greetings. I have cgi program which requires a big hash table. Is there any
resources(better yet, example codes) on shared memory where all my cgi
scripts can read in this hash table from a shared memory?
Thanks.
Stanley
------------------------------
Date: Sat, 09 Dec 2000 19:49:25 GMT
From: nospam.newton@gmx.li (Philip 'Yes, that's my address' Newton)
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <3a326489.591520327@news.tiscalinet.de>
On 8 Dec 2000 20:15:34 GMT, abigail@foad.org (Abigail) wrote:
> On Fri, 08 Dec 2000 19:50:39 -0000, Greg Bacon (gbacon@HiWAAY.net) wrote in comp.lang.perl.misc <URL: news:<t32esff1chr1d7@corp.supernews.com>>:
> ++
> ++ An easier way to boost your score would be to quote fewer lines. :-)
>
> But then, one loses context.
It also sounds as if "having a high OCR" is an end in itself.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Sat, 9 Dec 2000 20:41:28 -0000
From: "Al Bennett" <onthebog@hotmail.com>
Subject: substitution regexp
Message-Id: <90u5er$uuk$1@news8.svr.pol.co.uk>
hello
i'm new to this group so please forgive newbieness!
i am putting together part of a script to convert %%pagejump 12%%
(with any number) into an href link (with some added bits on the end) in a
parsed html file.
i have a substitution that looks like this..
$output =~ s/%%pagejump .*%%/replacement/g;
that matches the number
the problem is i want this to pick up any number and put some extra stuff
into the link, so i figured the best thing to do is call a subroutine and
pass the matched bit ( $& ) to it so it can do the processing and add the
extra bits and return the link, like this
$output =~ s/%%pagejump .*%%/&subroutine($&)/g;
it doesn't work tho. is there a way to call a sub routine in a
substitution?
or even better a method that does this in a neater way?
many thanks in advance
al
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quantum Mechanics: The dreams stuff is made of.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: Sat, 09 Dec 2000 21:42:25 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: substitution regexp
Message-Id: <5HxY5.95$B9.170598912@news.frii.net>
In article <90u5er$uuk$1@news8.svr.pol.co.uk>,
Al Bennett <onthebog@hotmail.com> wrote:
>hello
[...]
>
>$output =~ s/%%pagejump .*%%/&subroutine($&)/g;
>
>it doesn't work tho. is there a way to call a sub routine in a
>substitution?
>or even better a method that does this in a neater way?
>
You are looking for the 'e' substitution modifyer. Here is a dumb
example.
chris
#!/usr/bin/perl
sub fill {
return qq{<a href="$_[0]">$_[0]</a>};
}
while (<DATA>) {
s/%%(pagejump\s+\d+)%%/&fill($1)/eg;
print;
}
__END__
this is some thext that has one of these %%pagejump 12%% things in it.
For another %%pagejump 13%% and another %%pagejump 14%%.
--
This space intentionally left blank
------------------------------
Date: Sat, 09 Dec 2000 21:50:15 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: substitution regexp
Message-Id: <3A32A986.B437951C@acm.org>
Al Bennett wrote:
>
> hello
>
> i'm new to this group so please forgive newbieness!
>
> i am putting together part of a script to convert %%pagejump 12%%
> (with any number) into an href link (with some added bits on the end) in a
> parsed html file.
>
> i have a substitution that looks like this..
>
> $output =~ s/%%pagejump .*%%/replacement/g;
>
> that matches the number
>
> the problem is i want this to pick up any number and put some extra stuff
> into the link, so i figured the best thing to do is call a subroutine and
> pass the matched bit ( $& ) to it so it can do the processing and add the
> extra bits and return the link, like this
>
> $output =~ s/%%pagejump .*%%/&subroutine($&)/g;
>
> it doesn't work tho. is there a way to call a sub routine in a
> substitution?
> or even better a method that does this in a neater way?
$output =~ s/%%pagejump (\d+)%%/&subroutine($1)/eg;
John
------------------------------
Date: Sat, 09 Dec 2000 22:02:10 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: substitution regexp
Message-Id: <x7aea5l0d8.fsf@home.sysarch.com>
>>>>> "AB" == Al Bennett <onthebog@hotmail.com> writes:
AB> $output =~ s/%%pagejump .*%%/replacement/g;
AB> that matches the number
AB> $output =~ s/%%pagejump .*%%/&subroutine($&)/g;
use the /e modifier.
also don't use .* casually like that. it probably works as you don't
cross newlines and . won't match a newline by default. if you ever added
the /s modifier, it could blow up on you by matching too much. use the ?
(non_greedy) modifier to limit the match.
read perlre for more on /e and ?
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Sat, 09 Dec 2000 16:37:28 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Translate pixel colors into hex codes
Message-Id: <3A32606B.8D2066C7@rochester.rr.com>
Niek wrote:
...
> - Does anyone know of any existing algorythms, modules, etc. that can do
> this already, and can also be ported to Perl without to much hastle, or even
> exist in Perl already?
>
> If not:
>
> - Could anyone give an estimate of the complexity of reaching this endgoal
> for an average programmer with my degree of knowledge about image
> processing?
>
> For instance:
>
> - Is reading and parsing a bitmap as easy as I would imagine, i.e. read in
> information about every pixel and convert it to a hex code?
...
> Niek
Modules are your friend. There are lots of them that deal with images.
Check out GD, PerlMagick, Tk, etc (search the CPAN module list for
"image"). I like GD, but that depends highly on what you are doing (GD
uses 8-bit pixels with a color map, for example). It's not clear to me,
though, what you intend to do with the "hex code" of each pixel once you
get it. That's a lot of hex codes, and images are a lot prettier.
Example:
use GD;
open IM,"tp.jpg" or die "Oops, $!";
binmode IM;
$im=new GD::Image->newFromJpeg(IM);
($x,$y)=$im->getBounds();
for $ix (0..$x-1){
for $iy (0..$y-1){
($r,$g,$b)=$im->rgb($im->getPixel($ix,$iy));
printf "%2x%2x%2x\n",$r,$g,$b;
}
}
close IM;
--
Bob Walton
------------------------------
Date: Sat, 9 Dec 2000 20:53:13 +0100
From: "Niek" <eager@curious.com>
Subject: Re: Translate pixel colors into hex codes
Message-Id: <#mlUenhYAHA.332@net003s>
Bob Walton <bwalton@rochester.rr.com> wrote in
3A32606B.8D2066C7@rochester.rr.com...
> Niek wrote:
> ...
> > - Does anyone know of any existing algorythms, modules, etc. that can do
> > this already, and can also be ported to Perl without to much hastle, or
even
> > exist in Perl already?
> >
> > If not:
> >
> > - Could anyone give an estimate of the complexity of reaching this
endgoal
> > for an average programmer with my degree of knowledge about image
> > processing?
> >
> > For instance:
> >
> > - Is reading and parsing a bitmap as easy as I would imagine, i.e. read
in
> > information about every pixel and convert it to a hex code?
> ...
> > Niek
> Modules are your friend. There are lots of them that deal with images.
> Check out GD, PerlMagick, Tk, etc (search the CPAN module list for
> "image"). I like GD, but that depends highly on what you are doing (GD
> uses 8-bit pixels with a color map, for example).
Thanx a lot Bob! It's been very useful so far, but what do you mean by a
color map? What use does it have?
Thanx again
Niek
------------------------------
Date: Sat, 09 Dec 2000 22:39:41 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Translate pixel colors into hex codes
Message-Id: <3A32B54E.91635B4B@rochester.rr.com>
Niek wrote:
...
> Thanx a lot Bob! It's been very useful so far, but what do you mean by a
> color map? What use does it have?
...
> Niek
Read the GD docs:
perldoc GD
With a colormap, an image is represented with a palatte of N colors,
typically N=256. Each pixel holds an index into the colormap, rather
than the actual color of the pixel. The colormap holds the actual color
in which every pixel with that index will appear. So a full-color image
(like a JPEG) is modified by GD so it contains a maximum of 256 colors.
This will degrade the quality of a photograph a bit, but is fine for
typical computer graphics. Whether you want to use software which
represents your image with a colormap is up to you. Note that GIF
images are already colormapped. Depending on your computer, video
driver, and optional settings, the images displayed on your monitor may
be as well. The use of a colormap is two-fold: first, the amount of
storage required for the image is reduced to almost 1/3; second, the
colors in the palette may be altered to adjust the brightness, contrast,
etc of the image by simply changing the colors stored in the colormap --
the image pixels don't have to be modified. This can reduce the
computation time for generating certain effects. With today's video
cards and CPU's, that isn't such a big deal any more. HTH.
--
Bob Walton
------------------------------
Date: Sat, 09 Dec 2000 16:26:39 GMT
From: "Fabian" <fabianos@telia.com>
Subject: Using guestbookscript for printing labels.
Message-Id: <33tY5.2430$Kd1.343816@newsb.telia.net>
My guestbook visitors expects that i send them a letter.
However this means a lot of cuting and pasting.
I want my guestbook to show 3 different adresses in each row.
I have search in all the known guestbook scrips but havn't seen
what i'm searching for.
I have spend 50 hours for test programming but whithout results.
Is it possible to program it?
Regards
Fabian
------------------------------
Date: 9 Dec 2000 16:55:33 GMT
From: daniel@chetlin.com (Daniel Chetlin)
Subject: Re: Why isn't Perl highly orthogonal?
Message-Id: <90to650s27@news2.newsguy.com>
On Sat, 09 Dec 2000 08:54:13 GMT, Terrence Brannon <brannon@lnc.usc.edu> wrote:
>One day my boss asked me: "how do you get the length of an array in
>Perl?" So I told him:
>
>scalar @array;
>
>But of course what irked me is how unintuitive and irregular Perl is
>and how this forced my boss to ask me something like that.
>
>LENGTH $string => length $string
>LENGTH @array => scalar @array
>
>PORTION $string => substring $string, $offset, $length
>PORTION @array => @array[$offset..$offset+$length]
>
>In other words, conceptually similar operations do not map to the same
>name in Perl. Why does this make Perl a better and not worse language,
>than the intended replacement to Perl, Ruby, which is in fact highly
>regular in all places where Perl isn't, with the above being just a
>few examples?
Perhaps you and your boss see things differently from other programmers
regarding both of these examples. I don't think the majority of Perlers
identify the length of a string as similar to the size of an array. Why
not interpret `length @array' to mean the length of all array elements
combined? In fact, the Perlish way to determine the size of an array is
extremely natural to me, because the value of an array in scalar context
presents the ability to say `if (@array > 4)'. Wonderfully expressive,
and much more natural than `if (length @array > 4)', IMO. In your eyes,
which one seems better? Similar logic can be applied to your PORTIONs --
no Perl programmer equates substrings with slices. Why do you?
Generally, there is quite a major difference between strings and arrays
or even lists in Perl.
And I don't think you'll find that Ruby is different from Perl in this
way. A current thread on ruby-talk is the question of why String#sort
and Array#sort do what was perceived to be different things. I suspect
you would expect String#sort to sort by character, rather than by line.
-dlc
fbeel sbe gur gbegherq ynathntr; guvf vf uneq
------------------------------
Date: 9 Dec 2000 18:27:30 GMT
From: Thelma Lubkin <thelma@alpha2.csd.uwm.edu>
Subject: Re: Why isn't Perl highly orthogonal?
Message-Id: <90ttii$q6g$1@uwm.edu>
In comp.lang.perl.misc Dave Cross <dave@dave.org.uk> wrote:
: The length of a string and the number of elemetns in an array really
: aren't the same thing at all, so it makes sense to me that I find them
: in different ways. The same goes for substrings and array slices.
: Thinking of these concepts as similar seems to meto be a hangover from
: C, where strings are arrays of characters, but surely we've moved on
: since then.
: Maybe your boss is a C programmer?
if aray[8] can hold 8 5-character strings (ie aray's
elements are char*5), a C programmer would say it's a length
8 array, not a length 40 array.
Why the gratuitous insult to C programmers?
--thelma
who struggles along in both languages.
: Dave...
------------------------------
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 5073
**************************************