[28532] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 9896 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 27 03:06:09 2006

Date: Fri, 27 Oct 2006 00:05:07 -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           Fri, 27 Oct 2006     Volume: 10 Number: 9896

Today's topics:
    Re: complex regular expression question <mark.leeds@morganstanley.com>
        Date::Manip hours elapsed not business hours elapsed <rutherfc@gmail.com>
    Re: Encoding problem: Rsquo to a with a hat <afrinspray@gmail.com>
    Re: Encoding problem: Rsquo to a with a hat <afrinspray@gmail.com>
    Re: how do i update one section of a page leaving rest? <jurgenex@hotmail.com>
    Re: Naive threading performance questions <worky.workerson@gmail.com>
    Re: Naive threading performance questions <glex_no-spam@qwest-spam-no.invalid>
    Re: Naive threading performance questions xhoster@gmail.com
    Re: Naive threading performance questions xhoster@gmail.com
        new CPAN modules on Fri Oct 27 2006 (Randal Schwartz)
    Re: Simple question reg string matching <jgibson@mail.arc.nasa.gov>
    Re: Simple question reg string matching <tadmc@augustmail.com>
    Re: Sorting array of hash references <kalyanrajsista@gmail.com>
        Store multi-dimensions array for use in latter form? <shareparadise@gmail.com>
    Re: Store multi-dimensions array for use in latter form xhoster@gmail.com
    Re: Store multi-dimensions array for use in latter form <shareparadise@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 26 Oct 2006 16:11:59 -0700
From: "markpark" <mark.leeds@morganstanley.com>
Subject: Re: complex regular expression question
Message-Id: <1161904319.573217.261580@m73g2000cwd.googlegroups.com>


thank you to everyone who replied. for what i am doign, i don't
have to worry about berkshre hathaway ( i know
which stocks i
am pulling data for ). i really appreciate everyone's
responses. i am keying on the one that breaks
it up into
bucks and cents because that seems like
the one i have the greatest chance of understanding.
thanks again.



On Oct 26, 2:56 pm, Mirco Wahab <w...@chemie.uni-halle.de> wrote:
> Thus spoke Mirco Wahab (on 2006-10-26 19:18):
>
> >         my ($d,$t) =  $fields[0] =~ /\D+([-\d]+)\s+(.+?)$/;
> >         my  $buck  = ($fields[1] =~ /(\d{4})$/)[0] + 0;
> >         my ($cent) =  $fields[2] =~ /^(\d{2})/;According to Stevens remark, one would better
> write the extracion like:
>
>   ...
>   while(<DATA>) {
>     if( (my @fields = split /\./)   > 2 ) {
>       my ($d,$t) =  $fields[0] =~ /(\d{4}-[-\d]+)\s+(.+?)$/;
>       my  $buck  = ($fields[1] =~ /(\d{4})$/)[0] + 0;
>       my ($cent) =  $fields[2] =~ /^(\d{2})/;
>       printf "$d $t, %7.2f \$\n", $buck+$cent/100;
>    }
>  }
>  ...
>
> which would handle things like 4-digit stock prices
> and company names like T3332006-09-29-...
> 
> Regards
> 
> Mirco



------------------------------

Date: 26 Oct 2006 23:35:52 -0700
From: "rutherf" <rutherfc@gmail.com>
Subject: Date::Manip hours elapsed not business hours elapsed
Message-Id: <1161930952.441604.91680@i3g2000cwc.googlegroups.com>

Hello
Why does this print 49Hs and not 17Hrs as *I* expected???
Ive tryed bus mode 2 and 3 in DateCalc and other things but it always
gives me elapsed hrs not elapsed bus hrs
any help appreciated!


==========================================
use Date::Manip;

Date_Init("TZ=GMT","WorkWeekBeg=1","WorkWeekEnd=5","WorkDay24Hr=0","WorkDayBeg=09:00","WorkDayEnd=17:00");
$start = 'Oct 03 2006 09:34:28';
$end = 'Oct 05 2006 10:34:28';

$date1=ParseDate($start);
$date2=ParseDate($end);

$delta=DateCalc($date1,$date2,,2);
$bus_hrs=Delta_Format($delta,2,,"%ht");

print $bus_hrs;
====================================================



------------------------------

Date: 26 Oct 2006 15:57:58 -0700
From: "afrinspray" <afrinspray@gmail.com>
Subject: Re: Encoding problem: Rsquo to a with a hat
Message-Id: <1161902368.959798.12100@h48g2000cwc.googlegroups.com>

Sorry that was Todd W.:
http://groups-beta.google.com/group/comp.lang.perl.misc/browse_thread/thread/a1d24b4eec251e80/

Anyway, does anyone have any ideas how I can get it to stop converting
& n b s p ; and other standard HTML entities to gibberish?


Mike


Tad McClellan wrote:
> afrinspray <afrinspray@gmail.com> wrote:
>
> > Tad McClellan helped me out by referring me to
> > http://perlmonks.org/?node_id=554219
>
>
> No I didn't.
>
>
> --
>     Tad McClellan                          SGML consulting
>     tadmc@augustmail.com                   Perl programming
>     Fort Worth, Texas



------------------------------

Date: 26 Oct 2006 16:09:33 -0700
From: "afrinspray" <afrinspray@gmail.com>
Subject: Re: Encoding problem: Rsquo to a with a hat
Message-Id: <1161902277.755402.95610@f16g2000cwb.googlegroups.com>

Sorry that was Todd W.:
http://groups-beta.google.com/group/comp.lang.perl.misc/browse_thread/thread/a1d24b4eec251e80/

Anyway, does anyone have any ideas how I can get it to stop convert & n
b s p ; and other standard HTML entities to gibberish?


Mike

On Oct 26, 2:02 pm, Tad McClellan <t...@augustmail.com> wrote:
> afrinspray <afrinsp...@gmail.com> wrote:
> > Tad McClellan helped me out by referring me to
> >http://perlmonks.org/?node_id=554219No I didn't.
>
> --
>     Tad McClellan                          SGML consulting
>     t...@augustmail.com                   Perl programming
>     Fort Worth, Texas



------------------------------

Date: Fri, 27 Oct 2006 02:58:48 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: how do i update one section of a page leaving rest?
Message-Id: <IBe0h.12148$iM2.10409@trndny08>

gavino wrote:
> How Do i updae one section of  a page leaving the rest?

You could open that page in your favourite editor, delete the section you 
don't like, and type in the new content.

jue





------------------------------

Date: 26 Oct 2006 15:12:22 -0700
From: "Worky Workerson" <worky.workerson@gmail.com>
Subject: Re: Naive threading performance questions
Message-Id: <1161900742.779754.25080@f16g2000cwb.googlegroups.com>

> > Thanks!  This definitely improved the process, and it seems to max out
> > at about 30% faster than the original with 4 transformation threads.
> > Is Thread::Queue the accepted/best way to do this sort of heavy I/O
> > between threads or is there something with more throughput (on linux)?

> If you haven't already, start with the code that's doing the
> "transformation" and use parallel processing after that's optimized.
>
> You could post your transformation code, to see if there are
> better/faster ways to do it.
>
> You could write your transformation in C.

My code is in an isolated lab, so its difficult to transfer, however
I've profiled the transform with Devel::DProf, and it spends 90% of the
time doing CSV processing with Text::CSV_XS.  I figured that
Text::CSV_XS is already written in C and that optimizing the rest of my
code would only buy me a ~10% improvement, so it was time to look into
using more than one processor.

> You could use Parallel::ForkManager, which manages fork() nicely.

Hmm, I hadn't seen that module ... thanks ... looks easy enough.  The
forking that I would be doing would be relatively trivial, however.

> You could have the DB do some of the work.

Not for my purposes, i.e. bulk transform and loading.  Perl is *much*
faster than transforming the data within the database, especially if I
can transform it into a format that can be slurped up by the DB bulk
loader.  The DB can't be optimized for everything :)

> You could possibly do more optimized updates to the DB.

I'm using the bulk loading methods of my DB, and, like I mentioned
previously, the DB can accept data orders of magnitude faster than I
can feed it with my perl transform.  I was looking for the biggest
bang-for-the-buck.



------------------------------

Date: Thu, 26 Oct 2006 18:07:45 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Naive threading performance questions
Message-Id: <45413f92$0$10305$815e3792@news.qwest.net>

Worky Workerson wrote:

> Not for my purposes, i.e. bulk transform and loading.  Perl is *much*
> faster than transforming the data within the database, especially if I
> can transform it into a format that can be slurped up by the DB bulk
> loader.  The DB can't be optimized for everything :)

Yep.  You didn't mention the source of the data.

> 
>> You could possibly do more optimized updates to the DB.
> 
> I'm using the bulk loading methods of my DB, and, like I mentioned
> previously, the DB can accept data orders of magnitude faster than I
> can feed it with my perl transform.  I was looking for the biggest
> bang-for-the-buck.
> 

I was simply tossing out possible suggestions.

OK.  I understand a little better, now.  Thanks.

I'd agree with:

On Oct 26, 4:36 pm, xhos...@gmail.com wrote:
 > > My first choice would be to make N different files and process them
 > > independently.

I'm just curious.. Why is that inconvenient?

Since you mentioned you're on a Linux box:  man split

That would seem to be a very good solution and one you could tune, by 
forking more/less processes, to find an optimal solution.


------------------------------

Date: 27 Oct 2006 01:35:38 GMT
From: xhoster@gmail.com
Subject: Re: Naive threading performance questions
Message-Id: <20061026213631.044$2b@newsreader.com>

"Worky Workerson" <worky.workerson@gmail.com> wrote:
> On Oct 26, 4:36 pm, xhos...@gmail.com wrote:
> > "Worky Workerson" <worky.worker...@gmail.com> wrote:
> > > I'm doing ETL for a database, i.e. line-by-line transformation of
> > > fairly large data sets.  From some basic profiling, I've determined
> > > that the transformation process is relatively slow and I am heavily
> > > CPU bound on (i.e. the DB can take data 10 times faster than I can
> > > transform it).
> >
> > > Since I am on an 8-way box and each line is independent of the
> > > others, I decided to try my hand using perl threads.  I came up with
> > > a naive implementation (below), that spawns a couple of
> > > "transformation threads", where each thread is fed via a
> > > Thread::Queue.
>
> > My first choice would be to make N different files and process them
> > independently.  If that were inconvient, I'd start N processes, each
> > getting a $token from 0 to N-1, and each opening an independent handle
> > onto the one file and each one only processing the lines where
> > $. % $N == $token
>
> The first is, like you mentioned, inconvenient, but the token idea is
> excellent.  Thanks!

The main drawback of it is that it needs a real file, it can't use
streaming on STDIN.  Of course, you are also doing N times the (virtual)
file IO, but the file system cache generally makes that irrelevant.

>
> > > Is there
> > > some hidden synchronization bottleneck that I'm not seeing, or is a
> > > Thread::Queue not very efficient?
> > Thread::Queue is not very efficient for "flyweight" stuff because it
> > has a synchronization bottleneck.  I wouldn't exactly call this
> > "hidden", more like "implicit".
>
> What do you mean by "flyweight"?

I am assuming you are processing millions of lines, each of which take
less than 100 microsecond.  That is what I mean by flyweight.  As opposed
to doing a few thousand lines that each take tens of milliseconds.  As a
rule of thumb, if you do >1 millisecond of "real" work for every dequeue,
the overhead of Thread::Queue is insignificant.  If you do <50 microseconds
of "real" work per dequeue, then Thread::Queue will probably be the
bottleneck and by using it your overall task will get slower rather than
faster. Your mileage may vary, of course.

> I figured that this would be pretty
> IO intensive for Thread::Queue ...

Thread::Queue doesn't do I/O in the way I generally think of I/O.  It moves
stuff around in main memory, and does mutexs (or however your OS
accomplishes that), both of which I think are more competitive with CPU
load than they are with disk or network I/O.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


------------------------------

Date: 27 Oct 2006 02:23:52 GMT
From: xhoster@gmail.com
Subject: Re: Naive threading performance questions
Message-Id: <20061026222445.561$yC@newsreader.com>

"Worky Workerson" <worky.workerson@gmail.com> wrote:
> > > Thanks!  This definitely improved the process, and it seems to max
> > > out at about 30% faster than the original with 4 transformation
> > > threads. Is Thread::Queue the accepted/best way to do this sort of
> > > heavy I/O between threads or is there something with more throughput
> > > (on linux)?
>
> > If you haven't already, start with the code that's doing the
> > "transformation" and use parallel processing after that's optimized.
> >
> > You could post your transformation code, to see if there are
> > better/faster ways to do it.
> >
> > You could write your transformation in C.
>
> My code is in an isolated lab, so its difficult to transfer, however
> I've profiled the transform with Devel::DProf, and it spends 90% of the
> time doing CSV processing with Text::CSV_XS.  I figured that
> Text::CSV_XS is already written in C

It seems pretty weird that Text::CSV_XS would be slower than a database
load. I'm not sure I'd give up on that avenue for optimization quite yet.
Can you post an example of some data and code, and the top several subs
from dprofpp?  Maybe we can spot something that isn't going as well as it
could be. Of course, if parallelization turns out to be easy and
successful, then there is probably not point in delving too deeply.  Is
your data in ASCII/bytes, or in a wide character set?

> and that optimizing the rest of my
> code would only buy me a ~10% improvement, so it was time to look into
> using more than one processor.
>
> > You could use Parallel::ForkManager, which manages fork() nicely.
>
> Hmm, I hadn't seen that module ... thanks ... looks easy enough.  The
> forking that I would be doing would be relatively trivial, however.

Sure, but even more trivial is even better.

my $delay=50;
my $num_threads=5; # OK, not *threads* anymore.
my $file="whatever";

my $pm=Parallel::ForkManager->new($num_threads);

                                                foreach my $token
  (0..$num_threads-1) { $pm->start() and next;
  open my $fh, $file or die $!;
  open my $out, ">$file.$token" or die $!;
  while (my $line=<$fh>) {
      next unless $. % $num_threads == $token;
      my $sum;   # busy work
      foreach my $x ( 1..$delay) {   # simulate working hard
        foreach my $y (1..$delay) {  #           (very hard)
          $sum+=$x*$y
        }
      };
      print $out $line;
  }
  close $out or die $!;
  $pm->finish();
};
$pm->wait_all_children();


Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


------------------------------

Date: Fri, 27 Oct 2006 04:41:58 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Fri Oct 27 2006
Message-Id: <J7s2Dy.225E@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.

Astro-satpass-0.011
http://search.cpan.org/~wyant/Astro-satpass-0.011/
----
BSD-getloadavg-0.01
http://search.cpan.org/~dankogai/BSD-getloadavg-0.01/
Perl Interface to getloadavg (3)
----
CGI-Application-Plugin-Authentication-0.12
http://search.cpan.org/~ceeshek/CGI-Application-Plugin-Authentication-0.12/
Authentication framework for CGI::Application
----
CGI-Auth-Auto-1.004
http://search.cpan.org/~leocharre/CGI-Auth-Auto-1.004/
----
Catalyst-View-JSON-0.12
http://search.cpan.org/~miyagawa/Catalyst-View-JSON-0.12/
JSON view for your data
----
Compress-Raw-Bzip2-2.000_14
http://search.cpan.org/~pmqs/Compress-Raw-Bzip2-2.000_14/
Low-Level Interface to bzip2 compression library
----
Compress-Raw-Zlib-2.000_14
http://search.cpan.org/~pmqs/Compress-Raw-Zlib-2.000_14/
Low-Level Interface to zlib compression library
----
Compress-Zlib-2.000_14
http://search.cpan.org/~pmqs/Compress-Zlib-2.000_14/
Interface to zlib compression library
----
Crypt-Util-0.02
http://search.cpan.org/~nuffin/Crypt-Util-0.02/
A lightweight Crypt/Digest convenience API
----
DBD-InterBase-0.46
http://search.cpan.org/~edpratomo/DBD-InterBase-0.46/
DBI driver for Firebird and InterBase RDBMS server
----
DBD-WMI-0.04
http://search.cpan.org/~corion/DBD-WMI-0.04/
interface to the Windows WMI
----
Daemon-Generic-0.3
http://search.cpan.org/~muir/Daemon-Generic-0.3/
framework to provide start/stop/reload for a daemon
----
Email-MIME-CreateHTML-1.026
http://search.cpan.org/~bbc/Email-MIME-CreateHTML-1.026/
Multipart HTML Email builder
----
File-Size-0.05
http://search.cpan.org/~ofer/File-Size-0.05/
Get the size of files and directories
----
File-Size-0.06
http://search.cpan.org/~ofer/File-Size-0.06/
Get the size of files and directories
----
FormValidator-Simple-0.19
http://search.cpan.org/~lyokato/FormValidator-Simple-0.19/
validation with simple chains of constraints
----
Geo-SpaceManager-0.9.1
http://search.cpan.org/~jgibson/Geo-SpaceManager-0.9.1/
Place rectangles without overlap
----
Geo-SpaceManager-0.91
http://search.cpan.org/~jgibson/Geo-SpaceManager-0.91/
Place rectangles without overlap
----
Getopt-Euclid-v0.0.9
http://search.cpan.org/~dconway/Getopt-Euclid-v0.0.9/
Executable Uniform Command-Line Interface Descriptions
----
HTML-Dojo-0.0400
http://search.cpan.org/~cfranks/HTML-Dojo-0.0400/
Provides the Dojo JavaScript / AJAX distribution 0.4.0 files.
----
HTML-Dojo-0.0400.0
http://search.cpan.org/~cfranks/HTML-Dojo-0.0400.0/
Provides the Dojo JavaScript / AJAX distribution 0.4.0 files.
----
IO-AIO-2.0
http://search.cpan.org/~mlehmann/IO-AIO-2.0/
Asynchronous Input/Output
----
IO-Compress-Base-2.000_14
http://search.cpan.org/~pmqs/IO-Compress-Base-2.000_14/
Base Class for IO::Compress modules
----
IO-Compress-Bzip2-2.000_14
http://search.cpan.org/~pmqs/IO-Compress-Bzip2-2.000_14/
Write bzip2 files/buffers
----
IO-Compress-Lzf-2.000_14
http://search.cpan.org/~pmqs/IO-Compress-Lzf-2.000_14/
Write lzf files/buffers
----
IO-Compress-Lzop-2.000_14
http://search.cpan.org/~pmqs/IO-Compress-Lzop-2.000_14/
Write lzop files/buffers
----
IO-Compress-Zlib-2.000_14
http://search.cpan.org/~pmqs/IO-Compress-Zlib-2.000_14/
----
IPC-PubSub-0.20
http://search.cpan.org/~audreyt/IPC-PubSub-0.20/
Interprocess Publish/Subscribe channels
----
IPC-PubSub-0.21
http://search.cpan.org/~audreyt/IPC-PubSub-0.21/
Interprocess Publish/Subscribe channels
----
MIME-EncWords-0.032
http://search.cpan.org/~nezumi/MIME-EncWords-0.032/
deal with RFC-1522 encoded words (improved)
----
Number-Bytes-Human-0.06
http://search.cpan.org/~ferreira/Number-Bytes-Human-0.06/
Convert byte count to human readable format
----
POE-Component-Server-IRC-1.03
http://search.cpan.org/~bingos/POE-Component-Server-IRC-1.03/
a fully event-driven networkable IRC server daemon module.
----
Pod-Parser-1.35
http://search.cpan.org/~marekr/Pod-Parser-1.35/
base class for creating POD filters and translators
----
Qpsmtpd-Plugin-Quarantine-0.3
http://search.cpan.org/~muir/Qpsmtpd-Plugin-Quarantine-0.3/
filter outbound email to prevent blacklisting
----
SNMP-Persist-0.02
http://search.cpan.org/~anias/SNMP-Persist-0.02/
The SNMP pass_persist threaded backend
----
Sledge-Plugin-Inflate-0.01
http://search.cpan.org/~tokuhirom/Sledge-Plugin-Inflate-0.01/
inflate object from request or session.
----
Sledge-Plugin-Inflate-0.02
http://search.cpan.org/~tokuhirom/Sledge-Plugin-Inflate-0.02/
inflate object from request or session.
----
Software-Packager-Solaris-0.09
http://search.cpan.org/~rbdavison/Software-Packager-Solaris-0.09/
The Software::Packager extension for Solaris 2.5.1 and above
----
Software-Packager-Solaris-0.1
http://search.cpan.org/~rbdavison/Software-Packager-Solaris-0.1/
The Software::Packager extension for Solaris 2.5.1 and above
----
Sub-ForceEval-1.21
http://search.cpan.org/~lembark/Sub-ForceEval-1.21/
eval subroutines, re-throw exceptions if there is an eval; otherwise cluck and return undef.
----
Sub-ForceEval-1.22
http://search.cpan.org/~lembark/Sub-ForceEval-1.22/
eval subroutines, re-throw exceptions if there is an eval; otherwise cluck and return undef.
----
Test-XML-Order-0.02
http://search.cpan.org/~gam/Test-XML-Order-0.02/
Compare the order of XML tags in perl tests
----
Test-XML-Order-0.03
http://search.cpan.org/~gam/Test-XML-Order-0.03/
Compare the order of XML tags in perl tests
----
WebService-Yahoo-TermExtractor-0.01
http://search.cpan.org/~dwilson/WebService-Yahoo-TermExtractor-0.01/
Perl wrapper for the Yahoo! Term Extraction WebService
----
hub-standard-03.01.048
http://search.cpan.org/~ryangies/hub-standard-03.01.048/


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: Thu, 26 Oct 2006 15:21:45 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Simple question reg string matching
Message-Id: <261020061521451379%jgibson@mail.arc.nasa.gov>

In article <1161891126.760608.112970@b28g2000cwb.googlegroups.com>, K3
<kjkartik@gmail.com> wrote:

> I am a newbie to perl, so i wud appreciate if anyone give the code for
> finding the number of matches in a given string, allowing atmost m no
> of mismatches.
> 
> input: short string (len = k)
>            long string (len =n)
>            no of mismatches (=m)
>     
> output: no of matches allowing m mismatches 

In addition to following John's excellent advice, you will need (for
me, anyway) to define what you mean by a 'mismatch', with examples.

For example, if the string to be tested is 'aababcaabd' against the
pattern 'ab', I can see that there are 3 matches. However, I don't know
the number of mismatches. It could be 3 ('a', 'ca', 'd') or 6 ('aa',
'ba', 'bc', 'ca', 'aa', 'bd') or maybe something else, depending upon
how you define a mismatch.


------------------------------

Date: Thu, 26 Oct 2006 18:56:54 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Simple question reg string matching
Message-Id: <slrnek2iq6.hi7.tadmc@tadmc30.august.net>

K3 <kjkartik@gmail.com> wrote:

> I know how to do that thing normally. 


Then post your code, and we will help you improve it.



> But if u can give me some
         ^
> efficient code, I wud appreciate ur help.
                    ^^^            ^^

Please use real English.

You are being inconsiderate of those who don't have English
as their first language.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: 26 Oct 2006 23:38:06 -0700
From: "alwaysonnet" <kalyanrajsista@gmail.com>
Subject: Re: Sorting array of hash references
Message-Id: <1161931086.467706.233220@m7g2000cwm.googlegroups.com>

Hi Xho,

The code snippet you've provided really worked out for me.

Thanks,
Raj



------------------------------

Date: 26 Oct 2006 17:34:33 -0700
From: "shareparadise@gmail.com" <shareparadise@gmail.com>
Subject: Store multi-dimensions array for use in latter form?
Message-Id: <1161909273.456165.209130@i3g2000cwc.googlegroups.com>

Hi all,
I need a way to store a multi-dimensions array for later use in a
multi-steps form (the array created in the 1st form and need to be used
in 2nd, 3rd,... form).

I dont have permission to install session module on my server, so
sessions is not an option.

I tried to use cookie, but seem like I couldnt retrieve it back, I dont
know if I did it wrong somewhere or just Perl doesnt support that?

Can anyone please show me what  I could do in this situation?

Thank you so much!



------------------------------

Date: 27 Oct 2006 02:00:24 GMT
From: xhoster@gmail.com
Subject: Re: Store multi-dimensions array for use in latter form?
Message-Id: <20061026220117.183$DS@newsreader.com>

"shareparadise@gmail.com" <shareparadise@gmail.com> wrote:
> Hi all,
> I need a way to store a multi-dimensions array for later use in a
> multi-steps form (the array created in the 1st form and need to be used
> in 2nd, 3rd,... form).

Where does the array come from in the first place?

> I dont have permission to install session module on my server,

Why not?  Because they don't want to bother installing it for you?
(In which case, you could probably figure out how to install it on
your own.)  Or because they don't want you to use such a module for
policy reasons?  (In which case, you should ask your micro-manager how
to proceed, rather than asking us.  Who knows what other assinine policies
our recommendations will unknowningly violate.)

> I tried to use cookie, but seem like I couldnt retrieve it back, I dont
> know if I did it wrong somewhere or just Perl doesnt support that?

Since you didn't show us what you did, we can't comment on whether you did
it rightly or wrongly.  Maybe it is just too big to be stored in a cookie.

> Can anyone please show me what  I could do in this situation?

I often store it in a hidden field.  It has to be serialized, and it has
to be re-validated when you parse it again.  Since the AoA usualy was
created by parsing some block of text anyway, I generally use that same
block of text as the serialized form.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


------------------------------

Date: 26 Oct 2006 20:22:51 -0700
From: "shareparadise@gmail.com" <shareparadise@gmail.com>
Subject: Re: Store multi-dimensions array for use in latter form?
Message-Id: <1161919371.053472.75520@m7g2000cwm.googlegroups.com>

This project I'm doing is an assignment which will be tested on the
school server, and I know that server doesnt have session module
installed. I dont know if the grader would be kind enough to install it
for me, and I dont want to risk here.


This is how I tried to do it with cookie:

my $query = new CGI;

my $cookie = $query->cookie( -name     => 'table',
                                     -value    => @table, # tried
$table and \@table as well
                                     -expires  => '+1M',
                                     -path     => '/'
                                    );
print
$query->header(-cookie=>$cookie),$query->start_html(-title=>"Testing2");
# .....

# Then tried to retrieve it using this:
my @table = $query->cookie(-name=>'table');

Actually I tried with 1 dim array and it worked well, I dont know what
goes wrong here? This is my first hand experience with Perl so Im still
kinda confused.

Thanks.



------------------------------

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 9896
***************************************


home help back first fref pref prev next nref lref last post