From: merlyn
>>>>> "Jerald" == Jerald Sheets <questy@gmail.com> writes:
Jerald> On May 17, 2008, at 12:07 PM, Randal L. Schwartz wrote:
>>
>> ... and shuffle a bit of content between the
>> llama and alpaca to reflect the corresponding changes we've made in our
>> courseware.
Jerald> Courseware...
Jerald> Do tell. I'm interested.
Eh?
You must be new in town.
Stonehenge Consulting Services has been (and continues to be) one of the
leading providers of on-site and open-enrollment Perl training, dating all the
way back to 1994. We count 17 of the Fortune 100 as our clients.
Man, I need to fire my marketing staff if you don't know that. I guess you
never read the back cover of the llama or alpaca or early camel books, eh?
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
From: Jerald Sheets
On May 17, 2008, at 12:07 PM, Randal L. Schwartz wrote:
>
> ... and shuffle a bit of content between the
> llama and alpaca to reflect the corresponding changes we've made in
> our
> courseware.
Courseware...
Do tell. I'm interested.
--jms
From: Chas. Owens
On Sat, May 17, 2008 at 11:12 AM, Gowtham M <gowthamgowtham@gmail.com> wrote:
snip
> This may not be encryption but it might help in hiding your perl code.
>
> You might consider compiling your perl code to a native binary.
>
> http://www.indigostar.com/perl2exe.htm
snip
perl2exe suffers from the same problems all solutions will: you can
recover the source fairly easily*. Of course, that is only an issue
if you are trying to hide your source code (which is futile even with
things like ANSI C). If you don't want your users "stealing" your
code all you need is a proper license and a handy lawyer.
All of that said, there is a case to be made for presenting end-users
with a single file they run to get your program and PAR::Packer**
fills that need completely.
* http://www.net-security.org/vuln.php?id=2464
** http://search.cpan.org/dist/PAR-Packer/lib/PAR/Packer.pm
--
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.
From: Paul Johnson
On Sat, May 17, 2008 at 08:42:54PM +0530, Gowtham M wrote:
> I believe there is one such tool available in standard perl distro (perlcc)
> This perlcc was experimental when I first had a look at it (long time back),
> not sure how stable it is now.
You'll no doubt be very pleased to hear that it is now 100% stable.
AKA dead and buried.
--
Paul Johnson - paul@pjcj.net
http://www.pjcj.net
From: merlyn
>>>>> "Richard" == Richard Lee <rich.japh@gmail.com> writes:
Richard> I was going to order 5th version in june but does anyone in here know
Richard> the different between 3rd and 4th version? Is there a big
Richard> difference?
As I recall, the big changes between 3rd and 4th were to finally acknowledge
the existance of the alpaca book, and shuffle a bit of content between the
llama and alpaca to reflect the corresponding changes we've made in our
courseware. We released an updated alpaca after that as well.
The 5th edition covers the new 5.10 features of interest to beginners,
including some of the new regex options.
print "Just another Perl hacker,";
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
From: Richard Lee
Rob Dixon wrote:
> Richard Lee wrote:
>
>> Currently I own a 'learning perl' 3rd edition and I noticed that 5th
>> version is coming out in june.
>> What I didn't realize was that learning perl 4th edition's been out
>> since 2005.
>>
>> I was going to order 5th version in june but does anyone in here know
>> the different between 3rd and 4th version?
>> Is there a big difference?
>>
>
> Randal will tell you exactly what has changed if you can be patient until he
> notices this thread. But unless you're keen to save money by buying an old copy
> I'm sure it will be well worth waiting for the 5th edition in a few weeks.
>
> Rob
>
ok thanks.
I wanted to actually get another learning perl book but if 3rd and 4th
is different enough, I will get 4th and 5th book.
just wanted to know the difference and google does not have readily
comparision as I searched.
From: Gowtham M
On Wed, Apr 30, 2008 at 10:41 AM, Anirban Adhikary <
anirban.adhikary@gmail.com> wrote:
> Dear list
Hello
>
> I want to encrypt my perl source code. I am using some modules in my code.
> Among them some are downloaded from CPAn as well as some are written by my
> -self. So how to encrypt all perl codes includes the modules.
This may not be encryption but it might help in hiding your perl code.
You might consider compiling your perl code to a native binary.
http://www.indigostar.com/perl2exe.htm
I believe there is one such tool available in standard perl distro (perlcc)
This perlcc was experimental when I first had a look at it (long time back),
not sure how stable it
is now.
>
> Thanks&Regards in advance
> Anirban Adhikary
>
- Gowtham
From: Rob Dixon
Richard Lee wrote:
> Currently I own a 'learning perl' 3rd edition and I noticed that 5th
> version is coming out in june.
> What I didn't realize was that learning perl 4th edition's been out
> since 2005.
>
> I was going to order 5th version in june but does anyone in here know
> the different between 3rd and 4th version?
> Is there a big difference?
Randal will tell you exactly what has changed if you can be patient until he
notices this thread. But unless you're keen to save money by buying an old copy
I'm sure it will be well worth waiting for the 5th edition in a few weeks.
Rob
From: Richard Lee
Currently I own a 'learning perl' 3rd edition and I noticed that 5th
version is coming out in june.
What I didn't realize was that learning perl 4th edition's been out
since 2005.
I was going to order 5th version in june but does anyone in here know
the different between 3rd and 4th version?
Is there a big difference?
From: Octavian Rasnita
From: "Rob Dixon" <rob.dixon@gmx.com>
> (Once again, please bottom-post replies to this group. It maintains
> readability
> for extended threads. Salutations and signatures should always be edited
> out.
> You are responsible for the whole of your post, not just your own
> material.)
Maybe it improves the readability for the sighted, but well... I am blind
and I usually don't like to parse and read tens of lines until I reach the
few lines I need.
There is not a single accepted way of posting to a group. On the lists that
most of the users are Unix/Linux users, the most easy way is to bottom-post,
and I usually do that, unless I forget that I need to temporary change my
style, but when I want to send a final message and I don't need any answer
for it, I use to top-post.
> There are many things that "don't break the program" but are far from good
> programming practice. Start by taking out all whitespace, for example.
> When we think there is very little chance of our code being read by
> someone else
> or processed in a way we didn't anticipate, the World will surprise us.
> Being
> nice to the people who expect our program to be Pod-clean is part of the
> Perl
> ethos, and should be honoured.
As I said, for commenting more lines of text, perl doesn't have a mark, so I
am not creating a perl documentation. Why should I use a certain style for
creating a comment?
Other users won't see it, because those comments are usually temporary,
sometimes used when I don't want to include a piece of code in the program.
> The documentation that John referred you to recommends
>
> =begin comment
> :
> =end
And is this a valid perldoc mark?
> As a last resort you could make a case for not being nice to people and we
> will
> consider it here.
Please be so kind and explain what do you want to say, because I don't
understand your phrase. English is not my native language.
Do you want to say that I wasn't kind or that I said something badly to
someone?
Octavian
From: Rob Dixon
Octavian Rasnita wrote:
>
> From: "John W. Krahn" <krahnj@telus.net>
>
>> Octavian Rasnita wrote:
>>
>>> ----- Original Message ----- From: "sivasakthi" <msivasakthi@gmail.com>
>>>
>>>> How to comment Multiple lines in Perl?
>>>
>>> Perl doesn't have a multiline comment mark.
>>>
>>> You can use perldoc marks in order to comment what you want, or include
>>> the content in a string, like:
>>>
>>> Perldoc style:
>>>
>>> =start
>>> Here
>>> are the
>>> lines you
>>> want to comment
>>> =cut
>>
>> $ echo "
>>
>> =start
>> Here
>> are the
>> lines you
>> want to comment
>> =cut
>>
>> " | podchecker
>> *** ERROR: Unknown command 'start' at line 3 in file <standard input>
>> <&STDIN does not contain any pod commands.
>>
>
> I know that =start is not a valid POD command, but it doesn't break the
> program. When I use it, I don't need to use it to add real POD docs, so the
> commands shouldn't be valid.
>
> =head1 NAME
> is too long...
(Once again, please bottom-post replies to this group. It maintains readability
for extended threads. Salutations and signatures should always be edited out.
You are responsible for the whole of your post, not just your own material.)
There are many things that "don't break the program" but are far from good
programming practice. Start by taking out all whitespace, for example.
When we think there is very little chance of our code being read by someone else
or processed in a way we didn't anticipate, the World will surprise us. Being
nice to the people who expect our program to be Pod-clean is part of the Perl
ethos, and should be honoured.
Neither
=start
nor
=comment
are valid POD, and
=head1 NAME
is even worse, because it means something that you don't intend.
The documentation that John referred you to recommends
=begin comment
:
=end
Which may be a trifle awkward, but I'm sure there are worse things that happen
to you in your day. It takes less than a second to type, and if you do it a lot
you could set up a macro in your editor.
As a last resort you could make a case for not being nice to people and we will
consider it here.
HTH,
Rob
From: Octavian Rasnita
I know that =start is not a valid POD command, but it doesn't break the
program. When I use it, I don't need to use it to add real POD docs, so the
commands shouldn't be valid.
=head1 NAME
is too long...
Octavian
----- Original Message -----
From: "John W. Krahn" <krahnj@telus.net>
To: "Perl Beginners" <beginners@perl.org>
Sent: Friday, May 16, 2008 7:53 PM
Subject: Re: Multiline comment in Perl
> Octavian Rasnita wrote:
>>
>> ----- Original Message ----- From: "sivasakthi" <msivasakthi@gmail.com>
>>>
>>> How to comment Multiple lines in Perl?
>>
>> Perl doesn't have a multiline comment mark.
>>
>> You can use perldoc marks in order to comment what you want, or include
>> the content in a string, like:
>>
>> Perldoc style:
>>
>> =start
>> Here
>> are the
>> lines you
>> want to comment
>> =cut
>
> $ echo "
>
> =start
> Here
> are the
> lines you
> want to comment
> =cut
>
> " | podchecker
> *** ERROR: Unknown command 'start' at line 3 in file <standard input>
> <&STDIN does not contain any pod commands.
>
>
>
> John
> --
> Perl isn't a toolbox, but a small machine shop where you
> can special-order certain sorts of tools at low cost and
> in short order. -- Larry Wall
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> http://learn.perl.org/
>
>
From: Rob Dixon
anthony brooke wrote:
>
> Rob Dixon wrote:
>>
>> (I couldn't be bothered to reformat your post this time. Please bottom-post
>> on this group. It's said several times a week.)
>
> (Sorry, I really don't know about that, could you tell why must it in
> bottom ?)
Because extended threads become very hard to read if they're top-posted. Making
tidy posts about a programming language that may include embedded code is hard
to do anyway, and if they have to be read from the end backwards it makes them
even less likely to be understood. You should remove all sigs and salutations
and anything that's irrelevant to your own post. Each of us is responsible for
the formatting of all that we quote as well as our own material, and all posts
should make sense in isolation if read from the beginning to the end.
> Someone has given me a seems good solution,
> http://groups.google.com/group/comp.lang.perl.misc/browse_thread/thread/5e2d923994e833d9#
>
> I am going to dig more about mod_perl
Good. It would be nice if you let us know if you find a solution, or indeed if
you still need help :)
Rob
From: Rob Dixon
anthony brooke wrote:
>
> Thanks for the reply, it's a dynamic server side script that currently
> using CGI, but I am going for mod_perl. The interface is something like
> Google, so everytime the user make a request to lookup let's say the
> meaning of a word, the WordNet object have to be initialized. Is there a
> work around of this with mod_perl ? Thanks
(I couldn't be bothered to reformat your post this time. Please bottom-post on
this group. It's said several times a week.)
mod_perl is very lovely, but is also a niche application of Perl. From my
limited understanding of how it works I feel certain that it can maintain an
open dictionary for you, but you need more specific help than I can offer.
Does anybody have a simple answer to this, or know about a mod_perl list?
Rob
From: anthony brooke
Thanks for the reply, it's a dynamic server side script that currently using CGI, but I am going for mod_perl. The interface is something like Google, so everytime the user make a request to lookup let's say the meaning of a word, the WordNet object have to be initialized. Is there a work around of this with mod_perl ? Thanks
----- Original Message ----
From: Rob Dixon <rob.dixon@gmx.com>
To: beginner perl mailling list <beginners@perl.org>
Cc: anthony brooke <esia168@yahoo.com>
Sent: Saturday, May 17, 2008 0:47:52
Subject: Re: Initialize object permanently
anthony brooke wrote:
>
> Hello, I am using Wordnet::QueryData which allow access to a very huge dictionary data. The initialization of object
> my $wn = WordNet::QueryData->new;
>
> took
> 2 wallclock secs ( 2.36 usr + 0.07 sys = 2.43 CPU)
>
> Then the subsequent request for the data is exetremely fast
>
> For the lines below took
> 0 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
>
> print "Synset: ", join(", ", $wn->querySense("cat#n#7", "syns")), "\n";
> print "Hyponyms: ", join(", ", $wn->querySense("cat#n#1", "hypo")), "\n";
> print "Parts of Speech: ", join(", ", $wn->querySense("run")), "\n";
> print "Senses: ", join(", ", $wn->querySense("run#v")), "\n";
> print "Forms: ", join(", ", $wn->validForms("lay down#v")), "\n";
> print "Noun count: ", scalar($wn->listAllWords("noun")), "\n";
> print "Antonyms: ", join(", ", $wn->queryWord("dark#n#1", "ants")), "\n";
>
> I
> am developing a web application, is there a way to make the
> initialization of object permanently in memory ? I tried to use the
> Storable module. But that only give me a little increase in
> performance. Anybody's idea is very much appreciated, Thank you.
When you say 'web application', do you mean a server-side CGI script or a
client-side program that interrogates the Web and also needs access to the
dictionary?
Rob
--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/
Send instant messages to your online friends http://uk.messenger.yahoo.com
From: John W. Krahn
Octavian Rasnita wrote:
>
> ----- Original Message ----- From: "sivasakthi" <msivasakthi@gmail.com>
>>
>> How to comment Multiple lines in Perl?
>
> Perl doesn't have a multiline comment mark.
>
> You can use perldoc marks in order to comment what you want, or include
> the content in a string, like:
>
> Perldoc style:
>
> =start
> Here
> are the
> lines you
> want to comment
> =cut
$ echo "
=start
Here
are the
lines you
want to comment
=cut
" | podchecker
*** ERROR: Unknown command 'start' at line 3 in file <standard input>
<&STDIN does not contain any pod commands.
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
From: John W. Krahn
Beau E. Cox wrote:
> On Thu, May 15, 2008 at 11:24 PM, sivasakthi <msivasakthi@gmail.com> wrote:
>>
>> How to comment Multiple lines in Perl?
>
> =comment
> like this
> example
> =cut
$ echo "
=comment
like this
example
=cut
" | podchecker
*** ERROR: Unknown command 'comment' at line 3 in file <standard input>
<&STDIN does not contain any pod commands.
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
From: Rob Dixon
anthony brooke wrote:
>
> Hello, I am using Wordnet::QueryData which allow access to a very huge dictionary data. The initialization of object
> my $wn = WordNet::QueryData->new;
>
> took
> 2 wallclock secs ( 2.36 usr + 0.07 sys = 2.43 CPU)
>
> Then the subsequent request for the data is exetremely fast
>
> For the lines below took
> 0 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
>
> print "Synset: ", join(", ", $wn->querySense("cat#n#7", "syns")), "\n";
> print "Hyponyms: ", join(", ", $wn->querySense("cat#n#1", "hypo")), "\n";
> print "Parts of Speech: ", join(", ", $wn->querySense("run")), "\n";
> print "Senses: ", join(", ", $wn->querySense("run#v")), "\n";
> print "Forms: ", join(", ", $wn->validForms("lay down#v")), "\n";
> print "Noun count: ", scalar($wn->listAllWords("noun")), "\n";
> print "Antonyms: ", join(", ", $wn->queryWord("dark#n#1", "ants")), "\n";
>
> I
> am developing a web application, is there a way to make the
> initialization of object permanently in memory ? I tried to use the
> Storable module. But that only give me a little increase in
> performance. Anybody's idea is very much appreciated, Thank you.
When you say 'web application', do you mean a server-side CGI script or a
client-side program that interrogates the Web and also needs access to the
dictionary?
Rob
From: John W. Krahn
sivasakthi wrote:
> Hi all,
Hello,
> How to comment Multiple lines in Perl?
perldoc -q "How can I comment out a large block of perl code"
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
From: Chas. Owens
On May 16, 2008, at 04:55, anthony brooke wrote:
> Hello, I am using Wordnet::QueryData which allow access to a very
> huge dictionary data. The initialization of object
> my $wn = WordNet::QueryData->new;
>
> took
> 2 wallclock secs ( 2.36 usr + 0.07 sys = 2.43 CPU)
>
> Then the subsequent request for the data is exetremely fast
>
> For the lines below took
> 0 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
>
> print "Synset: ", join(", ", $wn->querySense("cat#n#7", "syns")),
> "\n";
> print "Hyponyms: ", join(", ", $wn->querySense("cat#n#1", "hypo")),
> "\n";
> print "Parts of Speech: ", join(", ", $wn->querySense("run")), "\n";
> print "Senses: ", join(", ", $wn->querySense("run#v")), "\n";
> print "Forms: ", join(", ", $wn->validForms("lay down#v")), "\n";
> print "Noun count: ", scalar($wn->listAllWords("noun")), "\n";
> print "Antonyms: ", join(", ", $wn->queryWord("dark#n#1", "ants")),
> "\n";
>
> I
> am developing a web application, is there a way to make the
> initialization of object permanently in memory ? I tried to use the
> Storable module. But that only give me a little increase in
> performance. Anybody's idea is very much appreciated, Thank you.
Your best bet is to take a daemon like approach. Startup a script
that does nothing but respond to requests by other scripts. Take a
look at the IPC::* modules to see how to do inter-process communication.
From: oryann9
On Thu, May 15, 2008 at 3:45 PM, Dr.Ruud <rvtol+news@isolution.nl> wrote:
> It contains a lot of bad advice too.
You have been helpful in the past so please be so kind to point out
the *bad Advice*... Just saying it's bad really helps no one on a
"beginners" list. The way I see it, people will read that information,
begin to code with it, then when they run into problems they come here
only to be chastised by using such examples. Why not end that loop by
good examples?
-
Horray, Horray! I agree with all stated here. I have been doing Perl for seven years now and still consider myself a beginner at many concepts.
From: Dr.Ruud
Jerald Sheets schreef:
> Dr.Ruud:
>> Richard Lee:
>>> [www.raycosoft.com/rayco/support/perl_tutor.html]
>>> this is very helpful to me. I always have trouble w/ map and
>>> grep(still do..) but this website is helpful
>>
>> It contains a lot of bad advice too.
>
> Look, someone asked for it by name, and I just obliged. Don't shoot
> the messenger... He packs a gun too...
Jerald, sorry for that.
Could you start quoting sensibly?
Only quote what you react on, certainly not quote signatures.
Each quote should contain just enough context to place your reaction
that follows it.
--
Affijn, Ruud
"Gewoon is een tijger."
From: Octavian Rasnita
Hi,
Perl doesn't have a multiline comment mark.
You can use perldoc marks in order to comment what you want, or include the
content in a string, like:
Perldoc style:
=start
Here
are the
lines you
want to comment
=cut
Or using a string:
q/
Here are
the
lines you
want to comment
/;
The program will work fine, but in the second example, if you use
use warnings;
it will tell you that you used this string in a void context.
If you don't like the warning, you could use:
my $zzz = q/
...
/;
The first way is prefered, but the second way allows you to comment one line
or more lines using the same syntax.
Octavian
----- Original Message -----
From: "sivasakthi" <msivasakthi@gmail.com>
To: "beginners perl" <beginners@perl.org>
Sent: Friday, May 16, 2008 12:24 PM
Subject: Multiline comment in Perl
> Hi all,
>
>
> How to comment Multiple lines in Perl?
>
>
>
> Thanks,
> Siva
>
>
>
From: Beau E. Cox
On Thu, May 15, 2008 at 11:24 PM, sivasakthi <msivasakthi@gmail.com> wrote:
> Hi all,
>
>
> How to comment Multiple lines in Perl?
>
>
>
> Thanks,
> Siva
>
=comment
like this
example
=cut
Aloha => Beau;
From: sivasakthi
Hi all,
How to comment Multiple lines in Perl?
Thanks,
Siva
From: anthony brooke
Hello, I am using Wordnet::QueryData which allow access to a very huge dictionary data. The initialization of object
my $wn = WordNet::QueryData->new;
took
2 wallclock secs ( 2.36 usr + 0.07 sys = 2.43 CPU)
Then the subsequent request for the data is exetremely fast
For the lines below took
0 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
print "Synset: ", join(", ", $wn->querySense("cat#n#7", "syns")), "\n";
print "Hyponyms: ", join(", ", $wn->querySense("cat#n#1", "hypo")), "\n";
print "Parts of Speech: ", join(", ", $wn->querySense("run")), "\n";
print "Senses: ", join(", ", $wn->querySense("run#v")), "\n";
print "Forms: ", join(", ", $wn->validForms("lay down#v")), "\n";
print "Noun count: ", scalar($wn->listAllWords("noun")), "\n";
print "Antonyms: ", join(", ", $wn->queryWord("dark#n#1", "ants")), "\n";
I
am developing a web application, is there a way to make the
initialization of object permanently in memory ? I tried to use the
Storable module. But that only give me a little increase in
performance. Anybody's idea is very much appreciated, Thank you.
William
Send instant messages to your online friends http://uk.messenger.yahoo.com
From: Omega -1911
On Thu, May 15, 2008 at 3:45 PM, Dr.Ruud <rvtol+news@isolution.nl> wrote:
> It contains a lot of bad advice too.
You have been helpful in the past so please be so kind to point out
the *bad Advice*... Just saying it's bad really helps no one on a
"beginners" list. The way I see it, people will read that information,
begin to code with it, then when they run into problems they come here
only to be chastised by using such examples. Why not end that loop by
good examples?
From: Dr.Ruud
Richard Lee schreef:
> Jerald Sheets:
>>
http://web.archive.org/web/20021004030027/www.raycosoft.com/rayco/support/perl_tutor.html
>
> this is very helpful to me. I always have trouble w/ map and
> grep(still do..) but this website is helpful
>
> thank you to bring up this website!!
It contains a lot of bad advice too.
--
Affijn, Ruud (and Richard, see how I quoted, start to trim your posts)
"Gewoon is een tijger."
From: Richard Lee
Jerald Sheets wrote:
>
> Here's one that's still in there:
>
> http://web.archive.org/web/20021004030027/www.raycosoft.com/rayco/support/perl_tutor.html
>
>
> Get it while it's good.
>
> Also, check out PerlMonks & The OReilley Perl site. Also, PlanetPerl
> is very helpful from time to time.
>
> --jms
>
>
> On May 15, 2008, at 11:42 AM, oryann9 wrote:
>
>> Does anyone know what happened to this website:
>> http://web.archive.org/web/20041123005900/http://www.raycosoft.com/rayco/support/perl_tutor.html
>>
>> It says its not available. I thought it was a great reference and
>> explained the diffs between map and grep and even sort.
>> Does anyone have a softcopy of its data that you can send me?
>>
>> thank you!
>>
>>
>>
>>
>>
>> --
>> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
>> For additional commands, e-mail: beginners-help@perl.org
>> http://learn.perl.org/
>>
>>
>
>
this is very helpful to me. I always have trouble w/ map and grep(still
do..) but this website is helpful
thank you to bring up this website!!
From: Li, Jialin
On Thu, May 15, 2008 at 12:13 PM, ANJAN PURKAYASTHA <
anjan.purkayastha@gmail.com> wrote:
> Hi,
> here is a problem I'm working on. It's not PERL-specific, rather it is a
> problem in sorting followed by grouping.
> Suppose I have a set of lines that have tab-delimited text, thus:
> 1 w 3 wer
> 2 a 4 rte
> 4 w 2 weg
> 6 d 4 fhg
> 5 d 7 dfl
> 6 w 4 ald
> 8 a 3 dsl
>
> I would like to first sort the lines based on the 2nd token (w,a, w, d,
> etc)
> and then group the lines based on the 2nd token.
>
> At the end of this sorting/grouping I should have the lines grouped thus:
> 2 a 4 rte
> 8 a 3 dsl
>
> 6 d 4 fhg
> 5 d 7 dfl
>
> 1 w 3 wer
> 4 w 2 weg
> 6 w 4 ald
>
>
> I can figure out the sorting. Are they any command/modules to do the
> grouping based on identical tokens?
>
> appreciate your input.
>
>
> tia,
> anjan
>
>
>
> --
> ANJAN PURKAYASTHA, PhD.
> Senior Computational Biologist
> ==========================
>
> 1101 King Street, Suite 310,
> Alexandria, VA 22314.
> 703.518.8040 (office)
> 703.740.6939 (mobile)
>
> email:
> anjan@vbi.vt.edu;
> anjan.purkayastha@gmail.com
>
> http://www.vbi.vt.edu
>
> ==========================
>
hash of array will solve your problem
use strict;
use warnings;
my %HofA;
map { push @{ $HofA{ (split)[1] } }, $_ } <DATA> ;
for my $key (sort keys %HofA) {
print $_ for @{ $HofA{$key} };
print "\n";
}
__DATA__
1 w 3 wer
2 a 4 rte
4 w 2 weg
6 d 4 fhg
5 d 7 dfl
6 w 4 ald
8 a 3 dsl
From: ANJAN PURKAYASTHA
Hi,
here is a problem I'm working on. It's not PERL-specific, rather it is a
problem in sorting followed by grouping.
Suppose I have a set of lines that have tab-delimited text, thus:
1 w 3 wer
2 a 4 rte
4 w 2 weg
6 d 4 fhg
5 d 7 dfl
6 w 4 ald
8 a 3 dsl
I would like to first sort the lines based on the 2nd token (w,a, w, d, etc)
and then group the lines based on the 2nd token.
At the end of this sorting/grouping I should have the lines grouped thus:
2 a 4 rte
8 a 3 dsl
6 d 4 fhg
5 d 7 dfl
1 w 3 wer
4 w 2 weg
6 w 4 ald
I can figure out the sorting. Are they any command/modules to do the
grouping based on identical tokens?
appreciate your input.
tia,
anjan
--
ANJAN PURKAYASTHA, PhD.
Senior Computational Biologist
==========================
1101 King Street, Suite 310,
Alexandria, VA 22314.
703.518.8040 (office)
703.740.6939 (mobile)
email:
anjan@vbi.vt.edu;
anjan.purkayastha@gmail.com
http://www.vbi.vt.edu
==========================
From: Chas. Owens
On May 14, 2008, at 20:25, Robert Hicks wrote:
> just "bad" pseudo code:
>
> sub one {
> $process->name(\$html) || $errors_from_one( $process->error() );
>
> $process->name(\$text) || $errors_from_one( $process->error() );
> }
>
> sub errors_from_one {
> my $error = @_;
>
> push (my @errors, $error);
>
> # do stuff to make sure the errors are uniq
>
> return my @uniq_error_list;
> }
>
>
> I want to be able to get at those errors later. Will something like
> that work?
>
> Robert
You may be better off creating a set of objects to handle this, but
here is a lightweight solution:
{ #limit visibility of @queue to these two functions
my @queue;
sub save_errors { push @queue, @_; }
sub handle_errors {
for my $error (@queue) {
#do something
}
}
}
sub one {
$process->name(\$html) or save_errors($process->error);
$process->name(\$text) or save_errors($process->error);
}
From: Jerald Sheets
Here's one that's still in there:
http://web.archive.org/web/20021004030027/www.raycosoft.com/rayco/support/perl_tutor.html
Get it while it's good.
Also, check out PerlMonks & The OReilley Perl site. Also, PlanetPerl
is very helpful from time to time.
--jms
On May 15, 2008, at 11:42 AM, oryann9 wrote:
> Does anyone know what happened to this website: http://web.archive.org/web/20041123005900/http://www.raycosoft.com/rayco/support/perl_tutor.html
> It says its not available. I thought it was a great reference and
> explained the diffs between map and grep and even sort.
> Does anyone have a softcopy of its data that you can send me?
>
> thank you!
>
>
>
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> http://learn.perl.org/
>
>
From: oryann9
Does anyone know what happened to this website: http://web.archive.org/web/20041123005900/http://www.raycosoft.com/rayco/support/perl_tutor.html
It says its not available. I thought it was a great reference and explained the diffs between map and grep and even sort.
Does anyone have a softcopy of its data that you can send me?
thank you!
From: Gunnar Hjalmarsson
roger61611@yahoo.com wrote:
> Hello, Is there someplace I can get perl (for Windows) with modules
> like OLE and Spreadsheet and such included already ? The PC here is
> sort of old and it would be neat to just download oerl (w/ modules)
> and start working vs downloading perl and then downlading/installing
> module by module.
http://www.indigostar.com/indigoperl.htm
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
From: roger61611
Hello, Is there someplace I can get perl (for Windows) with modules
like OLE and Spreadsheet and such included already ? The PC here is
sort of old and it would be neat to just download oerl (w/ modules)
and start working vs downloading perl and then downlading/installing
module by module.
Thank you.
From: Robert Hicks
just "bad" pseudo code:
sub one {
$process->name(\$html) || $errors_from_one( $process->error() );
$process->name(\$text) || $errors_from_one( $process->error() );
}
sub errors_from_one {
my $error = @_;
push (my @errors, $error);
# do stuff to make sure the errors are uniq
return my @uniq_error_list;
}
I want to be able to get at those errors later. Will something like that
work?
Robert
From: Gunnar Hjalmarsson
[ Please do not top-post! ]
Tech list wrote:
> Dr.Ruud wrote:
>> "Li, Jialin" schreef:
>>> On Wed, May 14, 2008 at 4:01 PM, Tech list
>>> <tech_list@womenshealth.com> wrote:
>>>> what is the correct way to get the number of items in an array?
>>>>
>>>> I used to use $#array
>>>
>>> $#array is the index of the last item, so the number should be
>>> $#array + 1, or
>>> scalar @array
>>
>> Please read perlvar about $[. Normally it is 0, but you can set it to a
>> different value, like -3 or 27.
>>
>> The $#array is the last index of @array, so $array[$#array] is
>> equivalent to $array[-1].
>>
>> The number of items in an array is returned by @array in scalar context,
>> examples:
>>
>> scalar(@array)
>>
>> (0+ @array)
>>
>> if (0 < @array) { ... }
>>
>> if (@array) { ... }
>
> Is $#array deprecated or not?
It's not deprecated. But, as others already have explained, it does not
represent the number of items in an array, which is what you asked
about, after all.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl