[28528] in Perl-Users-Digest
Perl-Users Digest, Issue: 9892 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 26 09:05:53 2006
Date: Thu, 26 Oct 2006 06:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 26 Oct 2006 Volume: 10 Number: 9892
Today's topics:
Re: Automatic login to a web page <zentara@highstream.net>
Re: can someone unban me from freenode irc? #perl ? <bik.mido@tiscalinet.it>
Check box use <kunanu@gmail.com>
Re: Check box use <scobloke2@infotop.co.uk>
Re: Check box use anno4000@radom.zrz.tu-berlin.de
new CPAN modules on Thu Oct 26 2006 (Randal Schwartz)
Re: Remove short words from a string anno4000@radom.zrz.tu-berlin.de
Sorting array of hash references <kalyanrajsista@gmail.com>
Re: Sorting array of hash references anno4000@radom.zrz.tu-berlin.de
Re: Sorting array of hash references <kalyanrajsista@gmail.com>
Re: Sorting array of hash references anno4000@radom.zrz.tu-berlin.de
Re: stop encoding of href in anchor meyerto@gmail.com
Re: stop encoding of href in anchor <m@remove.this.part.rtij.nl>
Re: string substitution for a file, without replacing p <bik.mido@tiscalinet.it>
Re: unable to calculate large file size <bik.mido@tiscalinet.it>
Re: use of variables <mritty@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 26 Oct 2006 10:55:26 GMT
From: zentara <zentara@highstream.net>
Subject: Re: Automatic login to a web page
Message-Id: <fs41k29r6ifjjrg4o349v8keb3ue2u9nik@4ax.com>
On 25 Oct 2006 08:36:04 -0700, "Jagjeet_Singh" <jagjeet.malhi@gmail.com>
wrote:
>Zentara,
>
>I have downloaded this install as per instructions given by you.
>
>And I have copied old code + new code [ for cokies ] into one file and
>execute it
>and getting this error.
We are not going to hold your hand, while you make every
little Perl mistake that a newbie ever encounters. Why don't
you learn a little about Perl first, by reading a book, or
tutorial? You just can't slap together copies of code and
expect them to work.
There is a perl.beginners maillist at
http://learn.perl.org/
>################################################
>[root@Vicky root]# cat a.pl
>#!/usr/bin/perl
>use warnings;
>use strict;
>use WWW::Mechanize;
>
>my $mechanize_with_a_memory_only_cookie_jar =
> WWW::Mechanize->new ( cookie_jar => {} );
>my $agent = WWW::Mechanize->new();
>my $cj = HTTP::Cookies->new(file => "/file/to/cookie_jar");
> $agent->cookie_jar($cj);
>
>my $username = 'jagjeetm';
>my $password = 'hello';
>my $url = 'http://210.7.90.193/indexmain.php'
>my $mech = WWW::Mechanize->new(autocheck => 1);
You don't use the cookie setup properly, you are just
copying code verbatim, and hoping it will work.
You set up 3 separate WWW::Mechanize objects, and
end up using the one without a cookie jar. You need to choose
just 1.
Try:
my $mech = WWW::Mechanize->new ( cookie_jar => {} );
then:
>
>$mech->get( $url );
>$mech->form_name("login form name");
>$mech->field("username", $username);
>$mech->field("password", $password);
>$mech->click("login button/submit name");
>
print $mech->content,"\n";
>$mech->content() =~ /sm.th. from Track.aspx/ and print "logged in\n"
#the above regex to Track.aspx surely will not work in your situation
#you need to customize it to what you receive back
>
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
------------------------------
Date: 26 Oct 2006 09:54:50 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: can someone unban me from freenode irc? #perl ?
Message-Id: <u9q0k2heeo5iii2cl17vt3mipl18v9r706@4ax.com>
On 25 Oct 2006 19:02:28 -0700, "gavino" <bootiack@yahoo.com> wrote:
>I think perl is nicer than ja-vaaa!
So what?!? Are you aware that you're replying to a post by "Sisyphus"
(whithout quoting it, for the n-th time) whose entire content I'm
quoting hereafeter?
: "John Bokma" <john@castleamber.com> wrote in message
: news:Xns9867ABDE871D4castleamber@130.133.1.4...
: > "gavino" <bootiack@yahoo.com> wrote:
: >
: > > ok this sucks lol
: > > damn it jim!
: > > ok
: > > 15 naked virgins for whoever lets me back in
: >
: > This is a Perl group, payments should be made in camels only (either with
: > one or two humps).
: >
:
: Humping camels is illegal .... in this country, anyway ;-)
:
: Cheers,
: Rob
Then again: SO WHAT?!?
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 26 Oct 2006 02:42:08 -0700
From: "Kuna" <kunanu@gmail.com>
Subject: Check box use
Message-Id: <1161855728.901525.53760@m73g2000cwd.googlegroups.com>
Hi All,
I need a help in a perl script. So let me explain about that script :
in the script there is a *.pl file and *.pm file where the .pl script
is calling the .pm modules and the .pm module is containing a html form
where there are some form fields and these form fields can be
downloaded by the user after entering data in there and again can be
uploaded to the form so I have done those but i need now to add
checkboxes before the fields where I can give a condition that if the
check box is true then after clicking download that will only download
the checked items and again if I want to upload then also the same
process. So I need some help to implement the checkboxes and to give
the output as my requirement . So please give your suggestions.
Thanks,
Kuna. :)
------------------------------
Date: Thu, 26 Oct 2006 11:09:31 +0100
From: Ian Wilson <scobloke2@infotop.co.uk>
Subject: Re: Check box use
Message-Id: <mI-dneHcGavAFN3YnZ2dnUVZ8tmdnZ2d@bt.com>
Kuna wrote:
> Hi All,
>
> I need a help in a perl script.
That is a nice short sentence, easy to understand. It is superfluous but
at least it is good English (though you should capitalize Perl).
> So let me explain about that script :
> in the script there is a *.pl file and *.pm file where the .pl script
> is calling the .pm modules and the .pm module is containing a html form
> where there are some form fields and these form fields can be
> downloaded by the user after entering data in there and again can be
> uploaded to the form so I have done those but i need now to add
> checkboxes before the fields where I can give a condition that if the
> check box is true then after clicking download that will only download
> the checked items and again if I want to upload then also the same
> process. So I need some help to implement the checkboxes and to give
> the output as my requirement .
That sentence is just too long for comprehension. I'd break it up into a
dozen or more sentences. I'd organize those sentences into three or four
paragraphs. If you don't do that you are making it hard for people like
me to understand you.
I think this "stream of consciousness" style may be suited to a few
avant-garde novelists but you have to be very lucid to get away with it.
I suspect it isn't a style that works well in newsgroups.
> So please give your suggestions.
I suggest you simplify your code and post *short* .pl and .pm files
here, then explain carefully what the code does and what you want it to
do instead. Give example output. Give desired output. Organize your
thoughts carefully. Above all, keep it short.
------------------------------
Date: 26 Oct 2006 10:12:51 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Check box use
Message-Id: <4qbg13Fmhg5jU1@news.dfncis.de>
Ian Wilson <scobloke2@infotop.co.uk> wrote in comp.lang.perl.misc:
> Kuna wrote:
> > Hi All,
> >
> > I need a help in a perl script.
>
> That is a nice short sentence, easy to understand. It is superfluous but
> at least it is good English (though you should capitalize Perl).
...and drop the indefinite article with "help".
Anno
------------------------------
Date: Thu, 26 Oct 2006 04:41:59 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Oct 26 2006
Message-Id: <J7q7pz.1KJJ@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
Album-1.05
http://search.cpan.org/~jv/Album-1.05/
Create and maintain browser based photo albums
----
Archive-Zip-1.18
http://search.cpan.org/~adamk/Archive-Zip-1.18/
Provide an interface to ZIP archive files.
----
CAM-DBF-1.02
http://search.cpan.org/~clotho/CAM-DBF-1.02/
Perl extension for reading and writing dBASE III DBF files
----
Carp-Always-0.07
http://search.cpan.org/~ferreira/Carp-Always-0.07/
Warns and dies noisily with stack backtraces
----
Class-BuildMethods-0.12
http://search.cpan.org/~ovid/Class-BuildMethods-0.12/
Lightweight implementation-agnostic generic methods.
----
Class-Tie-InsideOut-0.053
http://search.cpan.org/~rrwo/Class-Tie-InsideOut-0.053/
Inside-out objects on the cheap using tied hashes
----
Class-Trait-0.22
http://search.cpan.org/~ovid/Class-Trait-0.22/
An implementation of Traits in Perl
----
Config-XPath-0.02
http://search.cpan.org/~pevans/Config-XPath-0.02/
a module for retrieving configuration data from XML files by using XPath queries
----
Curses-UI-Grid-0.12
http://search.cpan.org/~adrianwit/Curses-UI-Grid-0.12/
Create and manipulate data in grid model
----
DBD-WMI-0.03
http://search.cpan.org/~corion/DBD-WMI-0.03/
interface to the Windows WMI
----
DateTime-Cron-Simple-0.3
http://search.cpan.org/~ferreira/DateTime-Cron-Simple-0.3/
Parse a cron entry and check against current time
----
DateTime-Format-Natural-EN-0.05
http://search.cpan.org/~schubiger/DateTime-Format-Natural-EN-0.05/
Create machine readable date/time with natural parsing logic
----
DateTime-Format-Natural-EN-0.06
http://search.cpan.org/~schubiger/DateTime-Format-Natural-EN-0.06/
Create machine readable date/time with natural parsing logic
----
DateTime-Span-Birth-0.01
http://search.cpan.org/~miyagawa/DateTime-Span-Birth-0.01/
Date span of birthdays for an age
----
DateTime-Span-Birthdate-0.02
http://search.cpan.org/~miyagawa/DateTime-Span-Birthdate-0.02/
Date span of birthdays for an age
----
DateTime-TimeZone-0.54
http://search.cpan.org/~drolsky/DateTime-TimeZone-0.54/
Time zone object base class and factory
----
Error-0.17008
http://search.cpan.org/~shlomif/Error-0.17008/
Error/exception handling in an OO-ish way
----
IPC-PubSub-0.10
http://search.cpan.org/~audreyt/IPC-PubSub-0.10/
Interprocess Publish/Subscribe channels
----
IPC-PubSub-0.11
http://search.cpan.org/~audreyt/IPC-PubSub-0.11/
Interprocess Publish/Subscribe channels
----
Ingres-Utility-IINamu-0.07
http://search.cpan.org/~worm/Ingres-Utility-IINamu-0.07/
API to iinamu Ingres RDBMS utility
----
Math-Pari-2.010709
http://search.cpan.org/~ilyaz/Math-Pari-2.010709/
Perl interface to PARI.
----
MessageBus-0.04
http://search.cpan.org/~audreyt/MessageBus-0.04/
Lightweight publish/subscribe messaging system
----
Module-Plan-Base-0.04
http://search.cpan.org/~adamk/Module-Plan-Base-0.04/
Base class for Module::Plan classes
----
Module-ScanDeps-0.68
http://search.cpan.org/~smueller/Module-ScanDeps-0.68/
Recursively scan Perl code for dependencies
----
Number-Bytes-Human-0.05
http://search.cpan.org/~ferreira/Number-Bytes-Human-0.05/
Convert byte count to human readable format
----
Object-Destroyer-1.99
http://search.cpan.org/~adamk/Object-Destroyer-1.99/
Make objects with circular references DESTROY normally
----
Object-Prototype-0.01
http://search.cpan.org/~dankogai/Object-Prototype-0.01/
Prototypal Object Model a la Javascript
----
PDF-CreateSimple-1-1
http://search.cpan.org/~evanzs/PDF-CreateSimple-1-1/
----
POE-Component-IRC-5.11
http://search.cpan.org/~bingos/POE-Component-IRC-5.11/
a fully event-driven IRC client module.
----
POE-Component-Win32-Service-1.05
http://search.cpan.org/~bingos/POE-Component-Win32-Service-1.05/
A POE component that provides non-blocking access to Win32::Service.
----
Package-Util-0.01
http://search.cpan.org/~adamk/Package-Util-0.01/
A Perl/XS implementation of package-related utilities
----
SNMP-Persist-0.01
http://search.cpan.org/~anias/SNMP-Persist-0.01/
The SNMP pass_persist threaded backend
----
Test-XML-Order-0.01
http://search.cpan.org/~gam/Test-XML-Order-0.01/
----
Tie-RefHash-1.35
http://search.cpan.org/~nuffin/Tie-RefHash-1.35/
use references as hash keys
----
WebService-SimpleAPI-Wikipedia-0.01
http://search.cpan.org/~yappo/WebService-SimpleAPI-Wikipedia-0.01/
Handle WikipediaAPI of SimpleAPI
----
XML-Compile-0.11
http://search.cpan.org/~markov/XML-Compile-0.11/
Compilation based XML processing
----
XML-RSS-1.12
http://search.cpan.org/~abh/XML-RSS-1.12/
creates and updates RSS files
----
XML-XPathScript-1.46
http://search.cpan.org/~yanick/XML-XPathScript-1.46/
a Perl framework for XML stylesheets
----
dTemplate-2.4.2
http://search.cpan.org/~dlux/dTemplate-2.4.2/
A simple yet powerful template handling logic with advanced features.
----
dTemplate-2.5
http://search.cpan.org/~dlux/dTemplate-2.5/
A simple yet powerful template handling logic with advanced features.
----
threads-1.45
http://search.cpan.org/~jdhedden/threads-1.45/
Perl interpreter-based threads
----
threads-shared-1.05
http://search.cpan.org/~jdhedden/threads-shared-1.05/
Perl extension for sharing data structures between threads
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 26 Oct 2006 10:53:40 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Remove short words from a string
Message-Id: <4qbidkFmhh6kU1@news.dfncis.de>
Ted Zlatanov <tzz@lifelogs.com> wrote in comp.lang.perl.misc:
> On 25 Oct 2006, yankeeinexile@gmail.com wrote:
>
> > "Leif Wessman" <leifwessman@hotmail.com> writes:
> >
> >> Hi all!
> >>
> >> How can I remove all words that have a length that is 3 or less?
[...]
> > Here is your hint.
> > grep { length > 3 } @words;
>
> That's not a good hint.
What's wrong with it?
Anno
------------------------------
Date: 26 Oct 2006 03:21:41 -0700
From: "alwaysonnet" <kalyanrajsista@gmail.com>
Subject: Sorting array of hash references
Message-Id: <1161858101.455820.107080@f16g2000cwb.googlegroups.com>
hi all,
I've got an array of hash-references as following. ( i've represented
hash-references as a table below)
Type A/C No Status(active/inactive)
Prefund 12345 Y
Prefund 45678 N
Receipt 78878 N
Receipt 32365 Y
Payment 56546 N
Payment 23456 N
Payment 34093 Y
I want to display all the active accounts (status with "Y") before
inactive accounts along with preserving the order by type ie., Prefund
should come first before Receipt and Payment along the order.
I've got the code which i've hard-coded the account type(Payment) and
then sorting according to their status.
foreach my $label(@accts) {
if ($label->{'batype'} eq "Payment") {
push(@acct_pay,$label);
}
}
foreach $x(@acct_pay) {
@sorted = sort { $b->{'baactive'} cmp $a->{'baactive'} } @acct_pay;
}
Is there any way of how to achieve this by sorting according to status
by preserving the account type order.
Thanks a ton,
Raj
------------------------------
Date: 26 Oct 2006 10:38:52 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Sorting array of hash references
Message-Id: <4qbhhsFm6rq5U1@news.dfncis.de>
alwaysonnet <kalyanrajsista@gmail.com> wrote in comp.lang.perl.misc:
> hi all,
>
> I've got an array of hash-references as following. ( i've represented
> hash-references as a table below)
It would have been *much* better to present Perl code that produces
the array of hashes instead of a table that leaves us guessing how
your data relate to your code.
> Type A/C No Status(active/inactive)
>
> Prefund 12345 Y
> Prefund 45678 N
> Receipt 78878 N
> Receipt 32365 Y
> Payment 56546 N
> Payment 23456 N
> Payment 34093 Y
>
> I want to display all the active accounts (status with "Y") before
> inactive accounts along with preserving the order by type ie., Prefund
> should come first before Receipt and Payment along the order.
Unless you're running a rather old version of Perl, Perl's sort() is
stable, meaning the original order is preserved when elements compare
equal. If you simply sort by status the result should be what you
want.
> I've got the code which i've hard-coded the account type(Payment) and
> then sorting according to their status.
>
> foreach my $label(@accts) {
> if ($label->{'batype'} eq "Payment") {
Is "batype" what appears in the column "Type"? Is "baactive" what
appears in column "Status(active/inactive)"? Please make explicit
what is what, don't let your readers guess.
> push(@acct_pay,$label);
> }
> }
> foreach $x(@acct_pay) {
> @sorted = sort { $b->{'baactive'} cmp $a->{'baactive'} } @acct_pay;
> }
>
> Is there any way of how to achieve this by sorting according to status
> by preserving the account type order.
That will only show the three "Payment" records. What does it have to
do with your question?
Anno
------------------------------
Date: 26 Oct 2006 04:40:34 -0700
From: "alwaysonnet" <kalyanrajsista@gmail.com>
Subject: Re: Sorting array of hash references
Message-Id: <1161862834.139189.243720@k70g2000cwa.googlegroups.com>
hi ,
"batype" refers to column "Type" , "baactive" refers to column
"Status(active/inactive)"?
anno, You're correct that the code will show only 3 records of
"Payment" type as I have put a condition like "if ($label->{'batype'}
eq "Payment") ".
I need to preserve the actual order of "Type" but for each "Type" i
need to sort with their active accounts.
Raj
anno4000@radom.zrz.tu-berlin.de wrote:
> alwaysonnet <kalyanrajsista@gmail.com> wrote in comp.lang.perl.misc:
> > hi all,
> >
> > I've got an array of hash-references as following. ( i've represented
> > hash-references as a table below)
>
> It would have been *much* better to present Perl code that produces
> the array of hashes instead of a table that leaves us guessing how
> your data relate to your code.
>
> > Type A/C No Status(active/inactive)
> >
> > Prefund 12345 Y
> > Prefund 45678 N
> > Receipt 78878 N
> > Receipt 32365 Y
> > Payment 56546 N
> > Payment 23456 N
> > Payment 34093 Y
> >
> > I want to display all the active accounts (status with "Y") before
> > inactive accounts along with preserving the order by type ie., Prefund
> > should come first before Receipt and Payment along the order.
>
> Unless you're running a rather old version of Perl, Perl's sort() is
> stable, meaning the original order is preserved when elements compare
> equal. If you simply sort by status the result should be what you
> want.
>
> > I've got the code which i've hard-coded the account type(Payment) and
> > then sorting according to their status.
> >
> > foreach my $label(@accts) {
> > if ($label->{'batype'} eq "Payment") {
>
> Is "batype" what appears in the column "Type"? Is "baactive" what
> appears in column "Status(active/inactive)"? Please make explicit
> what is what, don't let your readers guess.
>
> > push(@acct_pay,$label);
> > }
> > }
> > foreach $x(@acct_pay) {
> > @sorted = sort { $b->{'baactive'} cmp $a->{'baactive'} } @acct_pay;
> > }
> >
> > Is there any way of how to achieve this by sorting according to status
> > by preserving the account type order.
>
> That will only show the three "Payment" records. What does it have to
> do with your question?
>
> Anno
------------------------------
Date: 26 Oct 2006 12:24:42 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Sorting array of hash references
Message-Id: <4qbnoaFm3hjpU1@news.dfncis.de>
alwaysonnet <kalyanrajsista@gmail.com> wrote in comp.lang.perl.misc:
> hi ,
>
> "batype" refers to column "Type" , "baactive" refers to column
> "Status(active/inactive)"?
>
> anno, You're correct that the code will show only 3 records of
> "Payment" type as I have put a condition like "if ($label->{'batype'}
> eq "Payment") ".
>
> I need to preserve the actual order of "Type" but for each "Type" i
> need to sort with their active accounts.
[Tofu snipped. Don't do that]
So just sort by "baactive", your records are already sorted by "batype".
As I said in my previous reply, Perl's sort is stable unless you have
an old version of Perl.
Anno
------------------------------
Date: 26 Oct 2006 00:15:25 -0700
From: meyerto@gmail.com
Subject: Re: stop encoding of href in anchor
Message-Id: <1161846925.421509.126200@i42g2000cwa.googlegroups.com>
> Yes, it's pretty humorous that you still don't seem to understand what
> people have been trying to explain to you.
>
> Did you possibly try the 'unwanted' encoding in your browser?
>
> --
> Gunnar Hjalmarsson
> Email: http://www.gunnar.cc/cgi-bin/contact.pl
Actually, I do understand what some of these people are explaining, and
it appears that those people don't understand the issue. I definitely
don't want & separating my query parameters. It breaks the link.
For example:
good:
http://www.autotrader.com/fyc/vdp.jsp?dealer_id=94476&car_id=210332809
broken:
http://www.autotrader.com/fyc/vdp.jsp?dealer_id=94476&car_id=210332809
------------------------------
Date: Thu, 26 Oct 2006 12:00:37 +0200
From: Martijn Lievaart <m@remove.this.part.rtij.nl>
Subject: Re: stop encoding of href in anchor
Message-Id: <pan.2006.10.26.10.00.36.434768@remove.this.part.rtij.nl>
On Thu, 26 Oct 2006 00:15:25 -0700, meyerto wrote:
>> Yes, it's pretty humorous that you still don't seem to understand what
>> people have been trying to explain to you.
>>
>> Did you possibly try the 'unwanted' encoding in your browser?
>>
>> --
>> Gunnar Hjalmarsson
>> Email: http://www.gunnar.cc/cgi-bin/contact.pl
>
> Actually, I do understand what some of these people are explaining, and
> it appears that those people don't understand the issue. I definitely
> don't want & separating my query parameters. It breaks the link.
> For example:
>
> good:
> http://www.autotrader.com/fyc/vdp.jsp?dealer_id=94476&car_id=210332809
> broken:
> http://www.autotrader.com/fyc/vdp.jsp?dealer_id=94476&car_id=210332809
Did you actually try it? I did. http://ma.rtij.nl/amptest.html.
M4
--
Redundancy is a great way to introduce more single points of failure.
------------------------------
Date: 26 Oct 2006 13:51:22 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: string substitution for a file, without replacing partial string?
Message-Id: <4071k2hdcif2406i6bsilsts4mfbn7lu5k@4ax.com>
On 25 Oct 2006 13:19:57 -0700, "gavino" <bootiack@yahoo.com> wrote:
>I am sorry for whatever i have done to create your disliek for me.
I do not *really* dislike you. Actually, I don't even really know you.
I dislike most of what you post. I dislike you *through* that. I would
try not to judge you because of this, but it's hard not to. For
example, in this very same post you once again refuse to quote some
context, that's rude and annoying most of us here: I asked you to
*please* not do so repeatedly, but you're still doing it.
Also, you once again misspell "like": that's fine, and common. We all
do, all the time. But re-reading helps. And in such a short message,
so much more. I bet you do not re-read. That means lack of care for
your message, and indirectly of respect for those who are to read it.
>The script provided by X- above does work.
Again... "X-"?!?!?!? Take care, make proper attributions! And he
*guessed* what may have been wrong with your first attempt, i.e. he
understood you had a quoting problem on the command line, which is
*not* really a Perl matter. OTOH your regex came close to do what you
stated you wanted. Anno proposed a refinement of it that *exactly*
does that. But then, as I wrote, you didn't have an actual problem
with the regex, but with something else. And, what's most important,
you *didn't* include enough detail for one to understand that.
In fact you wrote:
: I have a file 50.txt and want to replace each 50 by itself with 450.
: I do not want 250 to become 2450 for example.
: What perl expression does this?
: perl -pi.bak -e 's/\b50\b/450/g' 50.txt #
: fails!
The fact that you use single quotes suggests that you're in a *NIX
shell. Just saying that the command "fails" (HOW?!?) suggests you
wanted a more refined regex, which has been supplied, not that you
were using the wrong quotes for your OS, which is bizarre!
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 26 Oct 2006 13:29:05 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: unable to calculate large file size
Message-Id: <2l01k2p1sgtmm4u2gu8mpgpc48npiq8783@4ax.com>
On 19 Oct 2006 14:00:48 +0200, Michele Dondi <bik.mido@tiscalinet.it>
wrote:
>>Point is that I would later have to work on files >16 GB. Hence I
>>haven't tested for intermediate values.
>
>1) *Please* do not top-post (see remark above);
>2) Then why don't you do it now? Just to know what's going on. I'm
>writing some sample code for you but I can't terminate it right now...
I'm afraid I'm a bit late... but I conjured up the following
(untested), hth:
#!/usr/bin/perl
use strict;
use warnings;
use constant { K => 2**10, M => 2**20, G=> 2**30 };
use Time::HiRes 'time';
sub printout {
local ($\,$,)=("\n","\t");
print @_;
}
my $chunk="\0" x M;
printout qw/size "fake" "real"/;
for (1..32) {
{
open my $fh1, '>:raw', 'test1' or
die "Can't open test file: $!\n";
open my $fh2, '>:raw', 'test2' or
die "Can't open test file: $!\n";
seek $fh1, $_*G-1, 0 or
die "Can't seek file: $!\n";
print $fh1 "\0";
print $fh2 $chunk for 1 .. $_*K;
}
printout "$_ Gb", map { my $start=time;
-s "test$_"; time-$start } 1,2;
}
unlink qw/test1 test2/;
__END__
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 26 Oct 2006 05:24:53 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: use of variables
Message-Id: <1161865493.060040.65610@k70g2000cwa.googlegroups.com>
Michael Perle wrote:
> news2003@wanadoo.es wrote:
> > $a = 10;
> > $b = 5;
> >
> > print "trail ". $a + $b . "\n"; # why this???
> > $perl sample3.pl
> > 5
>
> The precedence of the plus might be lower than
> the one of the string concatenation? I don't know,
Why are you guessing? Why aren't you just reading the documentation?
perldoc perlop
shows that they have the same precedence, and are left-associative.
Therefore the . operates first, then the +, then the second .
> but if so then the first statement would be like
>
> print ("trail " . $a) + ($b . "\n");
No, it would be:
print ( ("trail " . $a) + ($b . "\n") );
which is very different. Please enable warnings when you are testing
code. Your code there is the equivalent of:
(print ("trail " . $a) ) + ($b . "\n");
> where ($b + "\n") results in "5\n".
I have no idea what that means, because ($b + "\n") can *never* result
in "5\n". + returns numbers only.
> > If I change the last statement to
> > print "trail ". ($a + $b) . "\n"; # why this???
>
> Yes, that seems to confirm that I am right with the above.
Uh. No. It really doesn't. Not sure why you think it does.
Paul Lalli
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V10 Issue 9892
***************************************