Ask a Question related to PERL Beginners, Design and Development.
-
Ravi Malghan #1
upgrading perl to 5.6 from 5.005_03 question?
Hello: I have perl 5.005_03 on solaris 2.8 which was
installed with the OS. I would like to upgrade it to
5.6. Should I pkgrm the existing perl before I install
the new perl ? or is there any other recommended way
to upgrade.
Thanks
Ravi
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
[url]http://webhosting.yahoo.com/ps/sb/[/url]
Ravi Malghan Guest
-
Upgrading Question
I have put his off long enough... Is it possible to upgrade from Illustrator 9 to CS, or do I have to get 10? Is it possible to upgrade my OS... -
Upgrading Perl linux 5.6 rpm to 5.8.2 source
On a Linux system how can I remove the 5.6 rpm and then install the 5.8.2 from source and still maintain dependencies? If something is looking for... -
Upgrading from Perl 5.8.0 to Perl 5.8.2
I'm using Redhat 9.0 and after installing it, I came with Perl 5.8.0. Well, I tried to upgrade to 5.8.2 and instead of upgrading, it just installed... -
How Can I Install PERL Modules w/o Upgrading PERL?
Shalom! I absolutely hate it when I install a required module for one piece of software or another, and suddenly it begins installing the... -
Question about upgrading IDS
Hi all, I am new in informix database administration. I am currently using IDS 9.21.UC4 on Solaris7. However, it run very unstable, which usually... -
Michael C. Davis #2
Re: upgrading perl to 5.6 from 5.005_03 question?
Ravi,
I just upgraded from 5.6 to 5.8.0, and I can tell you I am VERY happy that
I left both perl installs intact, because it allowed me to compare the
operation of my code under each version. If there was a difference in how
my code worked, it was due to a change in the Perl version or my
installation of it. Fortunately I had a robust set of test cases to help
me track down any changes.
While I can't speak specifically about the differences between 5.005 and
5.6, I would very much want to leave 5.005 in place until I was satisfied
that 5.6 was installed and working. During the transition, you could have
one login with the environment (PERL5LIB, PATH etc) set to use the old Perl
and a different login that uses the new. Or somthing like that.
At 08:51 AM 2/2/04 -0800, Ravi Malghan wrote:>Hello: I have perl 5.005_03 on solaris 2.8 which was
>installed with the OS. I would like to upgrade it to
>5.6. Should I pkgrm the existing perl before I install
>the new perl ? or is there any other recommended way
>to upgrade.
>
>Thanks
>Ravi
>
>__________________________________
>Do you Yahoo!?
>Yahoo! SiteBuilder - Free web site building tool. Try it!
>[url]http://webhosting.yahoo.com/ps/sb/[/url]
>
>--
>To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
>For additional commands, e-mail: [email]beginners-help@perl.org[/email]
><http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>
>Michael C. Davis Guest
-
Rob Dixon #3
Re: upgrading perl to 5.6 from 5.005_03 question?
Ravi Malghan wrote:
Hi Ravi.>
> I have perl 5.005_03 on solaris 2.8 which was
> installed with the OS. I would like to upgrade it to
> 5.6. Should I pkgrm the existing perl before I install
> the new perl ? or is there any other recommended way
> to upgrade.
What do you mean by
If you have any Perl software that may rely on the current> Should I pkgrm the existing perl
version of Perl, then you should be careful. OTOH, if this is a
new installation without any Perl programs, then install a
recognised version of Perl as soon as you can. A version
'installed with the OS' isn't a safe place to start.
Rob
Rob Dixon Guest
-
Anthony Esposito #4
RE: upgrading perl to 5.6 from 5.005_03 question?
Instead of upgrading why not just install Perl 5.6 in a separate directory......just a thought!
Tony Esposito
Oracle Developer, Enterprise Business Intelligence
XO Communications
Plano, TX* 75074
Work Phone: 972-516-5344
Work Cell: 972-670-6144
Email: [email]anthony.esposito@xo.com[/email]*
-----Original Message-----
From: Rob Dixon [mailto:rob@dixon.port995.com]
Sent: Monday, February 02, 2004 12:50 PM
To: [email]beginners@perl.org[/email]
Subject: Re: upgrading perl to 5.6 from 5.005_03 question?
Ravi Malghan wrote:Hi Ravi.>
> I have perl 5.005_03 on solaris 2.8 which was
> installed with the OS. I would like to upgrade it to
> 5.6. Should I pkgrm the existing perl before I install
> the new perl ? or is there any other recommended way
> to upgrade.
What do you mean by
If you have any Perl software that may rely on the current> Should I pkgrm the existing perl
version of Perl, then you should be careful. OTOH, if this is a
new installation without any Perl programs, then install a
recognised version of Perl as soon as you can. A version
'installed with the OS' isn't a safe place to start.
Rob
--
To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
For additional commands, e-mail: [email]beginners-help@perl.org[/email]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
Anthony Esposito Guest
-
Rob Dixon #5
Re: upgrading perl to 5.6 from 5.005_03 question?
Anthony Esposito wrote:
Fine, unless you have several people writing software for your>
> Instead of upgrading why not just install Perl 5.6 in a
> separate directory......just a thought!
central core. Otherwise, obviously, they need to have a common
version of Perl.
Rob
Rob Dixon Guest
-
Drieux #6
Re: upgrading perl to 5.6 from 5.005_03 question?
At 08:51 AM 2/2/04 -0800, Ravi Malghan wrote:you might check with Sun, I think that they have> Hello: I have perl 5.005_03 on solaris 2.8 which was
> installed with the OS. I would like to upgrade it to
> 5.6. Should I pkgrm the existing perl before I install
> the new perl ? or is there any other recommended way
> to upgrade.
a patch that will upgrade their version of perl
that is actually in /usr/perl5.
So what you can do is build a version of perl 5.8.3
and install it in /usr/local/ you can then make the
symbolic link for /usr/bin/perl point at /usr/local/bin/perl
and Sun's stuff will work in it's own space, since it
is built to look for /usr/perl5/bin/perl
eg
vladimir: 59:] head /usr/bin/kstat | sed 's/^/ /'
#!/usr/perl5/bin/perl
#
# Copyright (c) 1999, 2001 by Sun Microsystems, Inc.
# All rights reserved.
#
#ident "@(#)kstat.pl 1.3 01/11/09 SMI"
require 5.6.1;
use strict;
use warnings;
vladimir: 60:]
HTH.
ciao
drieux
---
Drieux Guest
-
Dennis G. Wicks #7
Need help sorting by specific fields in file.
Greetings;
I have a file that I need to sort and currently I am just
sorting it by
@datalist = sort(@datalist);
but it will eventually have many more records and many of
them may be quite large, but I only need to sort on the
first six characters which would be faster. Wouldn't it?
I have looked at perldoc and it shows things like
@articles = sort {$a <=> $b} @files;
but I can't figure out how to tell the sort that $a and $b
are the first six characters of @datalist. That is numeric
data BTW.
Any help or pointers appreciated.
Dennis
Dennis G. Wicks Guest
-
Michael C. Davis #8
Re: Need help sorting by specific fields in file.
At 01:49 PM 2/2/04 -0600, Dennis G. Wicks wrote:
You start by assuming that $a will refer to one item from list of things>I have a file that I need to sort and currently I am just
>sorting it by
>
> @datalist = sort(@datalist);
>
>but it will eventually have many more records and many of
>them may be quite large, but I only need to sort on the
>first six characters which would be faster. Wouldn't it?
>
>I have looked at perldoc and it shows things like
>
> @articles = sort {$a <=> $b} @files;
>
>but I can't figure out how to tell the sort that $a and $b
>are the first six characters of @datalist. That is numeric
>data BTW.
being sorted, and that $b will refer to another item that $a is being
sorted against. That's what Perl takes it to mean when you refer to $a and
$b in a sort function call.
To tell Perl to sort on the first 6 chars of the two things being compared,
then do it like this:
@articles = sort { substr($a,0,6) cmp substr($b,0,6) } @datalist;
Note that we're using the string-specific operator 'cmp' rather than the
numeric operator <=> because we are comparing strings (the results of
substr) rather than the original numbers. (This code assumes each number
in your list is at least 6 characters long. If not, you may have a couple
extra hoops to jump through.)
The general form of the sort function call is
sort SUBNAME LIST
sort BLOCK LIST
sort LIST
and the BLOCK or SUBNAME part of the sort call tells Perl how to decide
whether, when comparing each pair of things from the list, the first one is
less than, equal to, or greater than the second one. For each pair, Perl
executes the given BLOCK or SUBNAME, substituting actual values for $a and
$b to decide which one comes out on top.
HTH.
Michael C. Davis Guest
-
Eric Edwards #9
Re: Need help sorting by specific fields in file.
Dennis,
Not to tell you how to run your business, but how is the date formatted in
the array?
It has been my experience in working with dates that they should be
formatted as 20040202. This allows you to sort on years that are different.
Eric
----- Original Message -----
From: "Dennis G. Wicks" <wix@eskimo.com>
To: <beginners@perl.org>
Sent: Monday, February 02, 2004 1:49 PM
Subject: Need help sorting by specific fields in file.
> Greetings;
>
> I have a file that I need to sort and currently I am just
> sorting it by
>
> @datalist = sort(@datalist);
>
> but it will eventually have many more records and many of
> them may be quite large, but I only need to sort on the
> first six characters which would be faster. Wouldn't it?
>
> I have looked at perldoc and it shows things like
>
> @articles = sort {$a <=> $b} @files;
>
> but I can't figure out how to tell the sort that $a and $b
> are the first six characters of @datalist. That is numeric
> data BTW.
>
> Any help or pointers appreciated.
>
> Dennis
>
>
> --
> To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
> For additional commands, e-mail: [email]beginners-help@perl.org[/email]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>Eric Edwards Guest
-
James Edward Gray II #10
Re: Need help sorting by specific fields in file.
On Feb 2, 2004, at 1:49 PM, Dennis G. Wicks wrote:
Okay, but you're not sorting a file there. You're sorting an array.> Greetings;
>
> I have a file that I need to sort and currently I am just
> sorting it by
>
> @datalist = sort(@datalist);
Maybe that array was loaded from a file, but we're dealing with in
memory arrays now.
You mention below that this is numeric data, so that should be:
@datalist = sort { $a <=> $b } @datalist;
Honestly, I don't know, but I suspect that it wouldn't. I could be> but it will eventually have many more records and many of
> them may be quite large, but I only need to sort on the
> first six characters which would be faster. Wouldn't it?
wrong. You could benchmark to find out. Thing is, first you have to
grab the first 6 characters off of all of them, that takes time.
You're also assuming that the default comparison, whatever it is, is
comparing every single character. I would hope it sort circuits as
soon as it has enough information to compare things. If it does, you
might slow it down, instead of speed it up.
More importantly, this is a problem to consider AFTER it becomes slow.
You say it's fast now. Great. Don't touch it. Computers can handle a
lot of information very fast these days and humans who spend time
coding a "faster" solution for something that was already happening in
the blink of an eye are silly.
My worry, just from reading your message, was: Is the dataset too big
to be placed into a single array in memory, as it seems you are doing?
@dataset = sort { substr($a, 0, 6) <=> substr($b, 0, 6) } @dataset;> I have looked at perldoc and it shows things like
>
> @articles = sort {$a <=> $b} @files;
>
> but I can't figure out how to tell the sort that $a and $b
> are the first six characters of @datalist. That is numeric
> data BTW.
>
> Any help or pointers appreciated.
That's just a basic grab the first 6 numbers and compare approach. For
big data sets though, we can possibly get faster:
@dataset =
map { $$_[1] }
sort { $$a[0] <=> $$b[0] }
map { [ substr($_, 0, 6), $_ ] } @dataset;
That's a little trickier. First, we build a list of all the sub
strings, then we compare, then we restore the original, but now sorted
list. Usually, this is faster, if a sort has complex transformations
needed to compare data and the list is big. However, I'm not sure how
much faster a dereference for those array refs I used is going to be
over a substr() call.
Again, you would have to benchmark to see if we're making any
meaningful gains here, which I'm doubtful of. Perl includes a standard
Benchmark module for this.
I hope that helps.
James
James Edward Gray II Guest
-
R. Joseph Newton #11
Re: Need help sorting by specific fields in file.
"Dennis G. Wicks" wrote:
Try this:> Greetings;
>
> I have a file that I need to sort and currently I am just
> sorting it by
>
> @datalist = sort(@datalist);
Joseph> @articles = sort {substr($a, 6) + 0 <=> substr($b, 6) + 0}
> @files;
>
> but I can't figure out how to tell the sort that $a and $b
> are the first six characters of @datalist. That is numeric
> data BTW.
R. Joseph Newton Guest
-
R. Joseph Newton #12
Re: Need help sorting by specific fields in file.
"R. Joseph Newton" wrote:
Correction inline. Forgot the start param for substr()
> "Dennis G. Wicks" wrote:
>>> > Greetings;
> >
> > I have a file that I need to sort and currently I am just
> > sorting it by
> >
> > @datalist = sort(@datalist);
> Try this:
>> + 0}> > @articles = sort {substr($a, 0, 6) + 0 <=> substr($b, 0, 6)>> > @files;
> >
> > but I can't figure out how to tell the sort that $a and $b
> > are the first six characters of @datalist. That is numeric
> > data BTW.
> Joseph
>
> --
> To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
> For additional commands, e-mail: [email]beginners-help@perl.org[/email]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>R. Joseph Newton Guest
-
Rob Dixon #13
Re: Need help sorting by specific fields in file.
R. Joseph Newton wrote:
Hi Joseph.>
> "Dennis G. Wicks" wrote:
>>> > Greetings;
> >
> > I have a file that I need to sort and currently I am just
> > sorting it by
> >
> > @datalist = sort(@datalist);
> Try this:
>> > @articles = sort {substr($a, 6) + 0 <=> substr($b, 6) + 0}
> > @files;
> >
> > but I can't figure out how to tell the sort that $a and $b
> > are the first six characters of @datalist. That is numeric
> > data BTW.
That's
substr STRING, OFFSET, LENGTH
also the TIE-fighter will force it's parameters to numeric,
so there's no need to add zero.
so it'll be:
sort {substr($a, 0, 6) <=> substr($b, 0, 6)} @files;
Rob
Rob Dixon Guest



Reply With Quote

