[28061] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9425 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 5 03:06:01 2006

Date: Wed, 5 Jul 2006 00:05:05 -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           Wed, 5 Jul 2006     Volume: 10 Number: 9425

Today's topics:
    Re: about ssh remote <joe@inwap.com>
    Re: Crimson Editor query <tadmc@augustmail.com>
    Re: How to eliminate the extra 0's in printing to html  <joe@inwap.com>
    Re: need simple beep and taint mode <joe@inwap.com>
    Re: need simple beep and taint mode <joe@inwap.com>
    Re: need simple beep and taint mode <sherm@Sherm-Pendleys-Computer.local>
        new CPAN modules on Wed Jul  5 2006 (Randal Schwartz)
    Re: Problem with split <rvtol+news@isolution.nl>
    Re: Problem with split <justin.0607@purestblue.com>
    Re: Problem with split <1usa@llenroc.ude.invalid>
    Re: Problem with split <DJStunks@gmail.com>
    Re: Problem with split <DJStunks@gmail.com>
    Re: Problem with split <1usa@llenroc.ude.invalid>
    Re: Problem with split <joe@inwap.com>
    Re: Problem with split <someone@example.com>
    Re: ReadKey/ ReadLine query <joe@inwap.com>
        Using reference for performance gain? <howachen@gmail.com>
    Re: Which is the perl questions ng for beginners <joe@inwap.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 04 Jul 2006 15:54:49 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: about ssh remote
Message-Id: <c-adnZ90HaZxbDfZnZ2dnUVZ_u-dnZ2d@comcast.com>

debbie523 wrote:
> I have a cgi script named test12.cgi
> There is a line
> 
> $output=`ssh -l userName serverName  echo hello`;
> print $output;

You neglected to specify how it should create a password-less connection.

   $output = `ssh -i $HOME/.ssh/id_rsa -l userName serverName echo hello`;

However, even that won't work.

Under CGI execution:
   1) you cannot assume that the current working directory has been set.
   2) you can assume that $USER, $HOME, and other variables are _not_ set.
   3) many web servers execute CGI programs with UID=nobody, which means
      private files (readable by only yourself) cannot be accessed.


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

Date: Tue, 4 Jul 2006 21:52:57 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Crimson Editor query
Message-Id: <slrneamac9.aum.tadmc@magna.augustmail.com>

V S Rawat <VSRawat@Invalid.none> wrote:

> Which editor do you use


Most professional programmers use vi or emacs.


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


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

Date: Tue, 04 Jul 2006 18:31:08 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: How to eliminate the extra 0's in printing to html lines?
Message-Id: <iYKdnTWEQoYNizbZnZ2dnUVZ_oudnZ2d@comcast.com>

Bart Van der Donck wrote:

> I see the same results here. The problem is that you can't trust the
> return value of the 'system'-command.

You most certainly _CAN_ trust the return value of the system() function.

The return value is documented, it's just not what you think it is.

   if (system($command) == 0) {
     print "The command '$command' executed with no errors\n";
   } else {
     warn  "The command '$command' returned a non-zero error code: $?\n";
   }

	-Joe


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

Date: Tue, 04 Jul 2006 18:53:11 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: need simple beep and taint mode
Message-Id: <4OadnYErtMwmhjbZnZ2dnUVZ_vydnZ2d@comcast.com>

Yohan N. Leder wrote:

> Nevertheless, because you talk about CGI orientation, it interest me too 
> to know how to produce a simple beep in internal speaker when script is 
> reached through web server and current STDOUT is a web browser. Do you 
> have an idea without using any external module ? Or, what's the module 
> that gives the best combination reliability-simplicity under both Unix 
> and Win ?

The phrase "current STDOUT is a web browser" means you want this to
happen while the CGI is executing on the web server.  If the web browser
is in France and the web server is in California, making the server's
internal speaker go 'beep' is really not a good idea.  There's no one
to hear it, and 100 hits per minute would create an awful noise in
the server room.

I assume you really want to make a noise on the PC the browser is
running on.  There is no way to do that in plain HTML, so you would
have to resort to something like Java, JavaScript, VBScript, Direct-X, etc.
That sort of behavior is _not_ portable and often not possible.

	-Joe


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

Date: Tue, 04 Jul 2006 18:56:46 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: need simple beep and taint mode
Message-Id: <4OadnYArtMwNgTbZnZ2dnUVZ_vydnZ2d@comcast.com>

Yohan N. Leder wrote:

> Also, and as I said to Sherm P. in this thread too, I'm interesting to 
> produce a sound (any sound) when the terminal is a web browser (in CGI 
> environment)

A web browser is not an ASCII terminal.  You'll need scripts embedded
in HTML, not control characters, to do that.


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

Date: Tue, 04 Jul 2006 22:04:21 -0400
From: Sherm Pendley <sherm@Sherm-Pendleys-Computer.local>
Subject: Re: need simple beep and taint mode
Message-Id: <m264icu7ru.fsf@Sherm-Pendleys-Computer.local>

Joe Smith <joe@inwap.com> writes:

> The phrase "current STDOUT is a web browser" means you want this to
> happen while the CGI is executing on the web server.  If the web browser
> is in France and the web server is in California, making the server's
> internal speaker go 'beep' is really not a good idea.

It can be entertaining as all get out though, if the admin is high strung,
on his third pot of coffee for the day, and hasn't noticed that the server
has a speaker plugged in. :-)

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Wed, 5 Jul 2006 04:42:07 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Wed Jul  5 2006
Message-Id: <J1wyE7.pE5@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.

Algorithm-Pair-Swiss-0.14
http://search.cpan.org/~ggoudsmit/Algorithm-Pair-Swiss-0.14/
Generate unique pairings for tournaments
----
Authen-Bitcard-0.86
http://search.cpan.org/~abh/Authen-Bitcard-0.86/
Bitcard authentication verification
----
Bot-CPAN-1.10
http://search.cpan.org/~fox/Bot-CPAN-1.10/
provides CPAN services via IRC
----
Bot-CPAN-1.11
http://search.cpan.org/~fox/Bot-CPAN-1.11/
provides CPAN services via IRC
----
CSS-Squish-0.05
http://search.cpan.org/~tsibley/CSS-Squish-0.05/
Compact many CSS files into one big file
----
Catalyst-Action-RenderView-0.04
http://search.cpan.org/~mramberg/Catalyst-Action-RenderView-0.04/
Sensible default end action.
----
Class-Meta-Express-0.03
http://search.cpan.org/~dwheeler/Class-Meta-Express-0.03/
Concise, expressive creation of Class::Meta classes
----
Crypt-OTP26-0.01
http://search.cpan.org/~osfameron/Crypt-OTP26-0.01/
a classic form of encryption
----
DBIx-Class-0.06999_05
http://search.cpan.org/~jguenther/DBIx-Class-0.06999_05/
Extensible and flexible object <-> relational mapper.
----
Data-Bind-0.24_02
http://search.cpan.org/~clkao/Data-Bind-0.24_02/
Bind and alias variables
----
Imager-0.51_02
http://search.cpan.org/~tonyc/Imager-0.51_02/
Perl extension for Generating 24 bit Images
----
Lemonldap-Handlers-Generic-3.0.0
http://search.cpan.org/~egerman/Lemonldap-Handlers-Generic-3.0.0/
Perl extension for Lemonldap sso system
----
Lingua-EN-Squeeze-2006.0704
http://search.cpan.org/~jariaalto/Lingua-EN-Squeeze-2006.0704/
Shorten text to minimum syllables by using hash table lookup and vowel deletion
----
Math-Complex-1.36
http://search.cpan.org/~jhi/Math-Complex-1.36/
complex numbers and associated mathematical functions
----
Math-Polynomial-Solve-2.10
http://search.cpan.org/~jgamble/Math-Polynomial-Solve-2.10/
Find the roots of polynomial equations.
----
MusicBrainz-Queries-0.11
http://search.cpan.org/~svanzoest/MusicBrainz-Queries-0.11/
MusicBrainz RDF Query Constants
----
Net-DNS-0.58
http://search.cpan.org/~olaf/Net-DNS-0.58/
Perl interface to the DNS resolver
----
Net-Download-XMLScripted-XMLScripted-0.1
http://search.cpan.org/~tsingh/Net-Download-XMLScripted-XMLScripted-0.1/
Perl XML scripted download program
----
OOPS-0.1004
http://search.cpan.org/~muir/OOPS-0.1004/
Object Oriented Persistent Store
----
Perl-Tags-0.21
http://search.cpan.org/~osfameron/Perl-Tags-0.21/
Generate (possibly exuberant) Ctags style tags for Perl sourcecode
----
PostScript-MailLabels-2.25
http://search.cpan.org/~ajackson/PostScript-MailLabels-2.25/
Modules for creating PostScript(tm) files of mailing address labels.
----
Pugs-Compiler-Rule-0.08
http://search.cpan.org/~fglock/Pugs-Compiler-Rule-0.08/
Compiler for Perl 6 Rules
----
RiveScript-1.00
http://search.cpan.org/~kirsle/RiveScript-1.00/
Rendering Intelligence Very Easily
----
RiveScript-1.01
http://search.cpan.org/~kirsle/RiveScript-1.01/
Rendering Intelligence Very Easily
----
Scrape-USPS-ZipLookup-2.5
http://search.cpan.org/~gregor/Scrape-USPS-ZipLookup-2.5/
Standardize U.S. postal addresses.
----
Set-Cluster-0.02
http://search.cpan.org/~tonvoon/Set-Cluster-0.02/
Distribute items across nodes in a load balanced way and show takeovers in failure scenarios
----
Spreadsheet-Read-0.16
http://search.cpan.org/~hmbrand/Spreadsheet-Read-0.16/
Meta-Wrapper for reading spreadsheet data
----
Spreadsheet-Read-0.17
http://search.cpan.org/~hmbrand/Spreadsheet-Read-0.17/
Meta-Wrapper for reading spreadsheet data
----
String-Gsub-0.02
http://search.cpan.org/~hio/String-Gsub-0.02/
regex on string object
----
String-Gsub-0.03
http://search.cpan.org/~hio/String-Gsub-0.03/
regex on string object
----
Test-MultiFork-0.6
http://search.cpan.org/~muir/Test-MultiFork-0.6/
Test suite support for multi-process programs
----
Time-TCB-0.000
http://search.cpan.org/~zefram/Time-TCB-0.000/
Barycentric Coordinate Time
----
Time-TCG-0.000
http://search.cpan.org/~zefram/Time-TCG-0.000/
Geocentric Coordinate Time and realisations
----
Time-UTC_SLS-0.000
http://search.cpan.org/~zefram/Time-UTC_SLS-0.000/
UTC with Smoothed Leap Seconds
----
perl-lint-mode-0.01
http://search.cpan.org/~jjore/perl-lint-mode-0.01/
----
perltidy-mode-0.01
http://search.cpan.org/~jjore/perltidy-mode-0.01/
----
v6-pugs-0.003
http://search.cpan.org/~fglock/v6-pugs-0.003/


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: Tue, 4 Jul 2006 23:53:06 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Problem with split
Message-Id: <e8ev2g.1bs.1@news.isolution.nl>

Ted schreef:
> I have appended a simple test script.
>
> The context is this.  There is a directory in which all of the files
> have been created with file names consisting of a root, a six digit
> date, and a 3 character extension, all separated by a period.  I
> expected the call to split would give me the three components of the
> file name.  It doesn't.  When I run this scriplet, I find
> $file_root,$bad_date, and $fext remain empty and the print statement
> in the conditional block gives me the original file name rather than
> the root concatenated with the extension (i.e. the result should be,
> but isn't, the original file name with the six digit date removed).
>
> Any ideas as to what I missed?
>
> Ted
> ===============================================

Missing:

  use strict ;
  use warnings ;

(and sprinkle some 'my')

> $some_dir = "C:/FVA/data/univeris/univeris0608";
>
> opendir (DIR, $some_dir) || die "can't opendir $some_dir\n";
> @fnames = readdir(DIR);
> closedir DIR;
>
> $count = @fnames;
> print $count;print "\n";

> $c = 0;
> my %file_names;
> for ( $i = 0 ; $i < $count ; ++$i ) {

You don't need the $i anywhere in the for-loop, so make that

  for my $fname (@fnames) { ... }


>   ++$c;
>   print "$fnames[$i]\n";
>   ($file_root,$bad_date,$fext) = split(/./,$fnames[$i]);

The dot inside /./ doesn not mean what you think it means.

There will be a '.' and '..' in your dir, you can use -f to skip those.


>   print "file root = $file_root\nbad date = $bad_date\nfile extention
> = $fext\n";
>   if ( length($file_root) > 0) {
>     $file_names{$fnames[$i]} = "$file_root.$fext";
>     print $file_names{$fnames[$i]};print "\n\n";
>   }
> }
> print "\nThere are $c files in $some_dir.\n";

-- 
Affijn, Ruud

"Gewoon is een tijger."




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

Date: Tue, 04 Jul 2006 22:50:00 -0000
From: Justin C <justin.0607@purestblue.com>
Subject: Re: Problem with split
Message-Id: <slrneals2r.358.justin.0607@moonlight.purestblue.com>

On 2006-07-04, Ted <r.ted.byers@rogers.com> wrote:
> I have appended a simple test script.
>
> The context is this.  There is a directory in which all of the files
> have been created with file names consisting of a root, a six digit
> date, and a 3 character extension, all separated by a period.  I

[snip]

Disclaimer: I know nothing!

I had something similar today, I just escaped the '.':

    my ( $a, $b, $c ) = split /\./ ;

But there are probably a million reasons *not* to do that... one of
which will be along any minute now.


	Justin.

-- 
Justin C, by the sea. 


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

Date: Tue, 04 Jul 2006 23:30:10 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Problem with split
Message-Id: <Xns97F6C67D1FA6Basu1cornelledu@127.0.0.1>

Justin C <justin.0607@purestblue.com> wrote in 
news:slrneals2r.358.justin.0607@moonlight.purestblue.com:

> On 2006-07-04, Ted <r.ted.byers@rogers.com> wrote:
>> I have appended a simple test script.
>>
>> The context is this.  There is a directory in which all of the files
>> have been created with file names consisting of a root, a six digit
>> date, and a 3 character extension, all separated by a period.  I
> 
 ...

>     my ( $a, $b, $c ) = split /\./ ;
> 
> But there are probably a million reasons *not* to do that...

Nope, in this context, that is the right thing to do, because the first 
argument of split is a regex, and . is a special character in regexes, so 
it needs to be escaped when you want it only match a period.

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: 4 Jul 2006 16:57:56 -0700
From: "DJ Stunks" <DJStunks@gmail.com>
Subject: Re: Problem with split
Message-Id: <1152057476.217992.62270@75g2000cwc.googlegroups.com>

A. Sinan Unur wrote:
> Justin C <justin.0607@purestblue.com> wrote in
> > On 2006-07-04, Ted <r.ted.byers@rogers.com> wrote:
> >> I have appended a simple test script.
> >>
> >> The context is this.  There is a directory in which all of the files
> >> have been created with file names consisting of a root, a six digit
> >> date, and a 3 character extension, all separated by a period.  I
> >
> >     my ( $a, $b, $c ) = split /\./ ;
> >
> > But there are probably a million reasons *not* to do that...
>
> Nope, in this context, that is the right thing to do, because the first
> argument of split is a regex, and . is a special character in regexes, so
> it needs to be escaped when you want it only match a period.

Question - when he was splitting on /./ why did he get an empty list?

Observe:
  C:\>perl -Mstrict -we "print qq{[$_]} for split /./,'some.string'"

  C:\>perl -Mstrict -we "print qq{[$_]} for split /s/,'some.string'"
  [][ome.][tring]
  C:\>perl -Mstrict -we "print qq{[$_]} for split /\./,'some.string'"
  [some][string]
  C:\>perl -Mstrict -we "print qq{[$_]} for split //,'some.string'"
  [s][o][m][e][.][s][t][r][i][n][g]

Wacky?  I would have expected /./ to function essentially like //....

  This is perl, v5.8.7 built for MSWin32-x86-multi-thread

-jp



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

Date: 4 Jul 2006 17:23:19 -0700
From: "DJ Stunks" <DJStunks@gmail.com>
Subject: Re: Problem with split
Message-Id: <1152058999.182079.297620@l70g2000cwa.googlegroups.com>

DJ Stunks wrote:
> A. Sinan Unur wrote:
> > Justin C <justin.0607@purestblue.com> wrote in
> > > On 2006-07-04, Ted <r.ted.byers@rogers.com> wrote:
> > >> I have appended a simple test script.
> > >>
> > >> The context is this.  There is a directory in which all of the files
> > >> have been created with file names consisting of a root, a six digit
> > >> date, and a 3 character extension, all separated by a period.  I
> > >
> > >     my ( $a, $b, $c ) = split /\./ ;
> > >
> > > But there are probably a million reasons *not* to do that...
> >
> > Nope, in this context, that is the right thing to do, because the first
> > argument of split is a regex, and . is a special character in regexes, so
> > it needs to be escaped when you want it only match a period.
>
> Question - when he was splitting on /./ why did he get an empty list?
>
> Observe:
>   C:\>perl -Mstrict -we "print qq{[$_]} for split /./,'some.string'"
>
>   C:\>perl -Mstrict -we "print qq{[$_]} for split /s/,'some.string'"
>   [][ome.][tring]
>   C:\>perl -Mstrict -we "print qq{[$_]} for split /\./,'some.string'"
>   [some][string]
>   C:\>perl -Mstrict -we "print qq{[$_]} for split //,'some.string'"
>   [s][o][m][e][.][s][t][r][i][n][g]
>
> Wacky?  I would have expected /./ to function essentially like //....

Nevermind, I understand now.... I should have included a couple more
test cases:

  C:\>perl -MList::MoreUtils=uniq -e "print uniq split
//,'some.string'"
  some.tring
  C:\>perl -e "print qq{[$_]} for split /[some.tring]/,'some.string'"

  C:\>perl -e "print qq{[$_]} for split /[some.ring]/,'some.string'"
  [][][][][][][t]

Pardon the interruption...

-jp



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

Date: Wed, 05 Jul 2006 00:30:49 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Problem with split
Message-Id: <Xns97F6D0C5920C8asu1cornelledu@127.0.0.1>

"DJ Stunks" <DJStunks@gmail.com> wrote in
news:1152058999.182079.297620@l70g2000cwa.googlegroups.com: 

> DJ Stunks wrote:

 ...

>> Question - when he was splitting on /./ why did he get an empty list?
>>
>> Observe:
>>   C:\>perl -Mstrict -we "print qq{[$_]} for split /./,'some.string'"

Every character is a separator. Therefore, there are no fields.

>>   C:\>perl -Mstrict -we "print qq{[$_]} for split /s/,'some.string'"
>>   [][ome.][tring]

's' is a separator. split preserves empty leading fields.

>>   C:\>perl -Mstrict -we "print qq{[$_]} for split /\./,'some.string'"
>>   [some][string]

'.' is a separator.

>>   C:\>perl -Mstrict -we "print qq{[$_]} for split //,'some.string'"
>>   [s][o][m][e][.][s][t][r][i][n][g]

Every character is a field because the separator is empty pattern.

>> Wacky?

Very logical.

> Nevermind, I understand now.... I should have included a couple more
> test cases:

I thought a verbal explanation might be useful to some.

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: Tue, 04 Jul 2006 17:56:42 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: Problem with split
Message-Id: <8vKdnf5hwfDgkzbZnZ2dnUVZ_oqdnZ2d@comcast.com>

DJ Stunks wrote:

> Question - when he was splitting on /./ why did he get an empty list?

The first argument to split is what _not_ to return.


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

Date: Wed, 05 Jul 2006 05:02:04 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Problem with split
Message-Id: <gJHqg.118237$S61.39607@edtnps90>

A. Sinan Unur wrote:
> "DJ Stunks" <DJStunks@gmail.com> wrote in
> news:1152058999.182079.297620@l70g2000cwa.googlegroups.com: 
> 
>>DJ Stunks wrote:
> 
> ...
> 
>>>Question - when he was splitting on /./ why did he get an empty list?
>>>
>>>Observe:
>>>  C:\>perl -Mstrict -we "print qq{[$_]} for split /./,'some.string'"
> 
> Every character is a separator. Therefore, there are no fields.

Actually there are a lot of fields, its just that empty trailing fields aren't
returned from split unless you use a negative third argument:

$ perl -le 'print map qq{[$_]}, split /./, q[some.string]'

$ perl -le 'print map qq{[$_]}, split /./, q[some.string], -1'
[][][][][][][][][][][][]



John
-- 
use Perl;
program
fulfillment


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

Date: Tue, 04 Jul 2006 18:19:15 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: ReadKey/ ReadLine query
Message-Id: <HsqdnSvXZP1bjjbZnZ2dnUVZ_uudnZ2d@comcast.com>

V S Rawat wrote:

>>         while ( defined ($_ = $term->readline($prompt)) ) {
>>             $InFile = eval($_);

Why in the heck are you doing that?  If you enter "test.txt", then
eval("test.txt") is the same as {"test"."txt"} which concatenates
two barewords together.  Likewise, entering "2+3*4" results in 14.

Get rid of that eval().

     unless (-e $_) {
         print "Error: $_ does not exist\n";
         next;
     }
     if (-f $_) {
         $InFile = $_;
     } else {
         print "Error: $_ exists but is not a file\n";
         next;
     }

		-Joe


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

Date: 4 Jul 2006 20:06:21 -0700
From: "howa" <howachen@gmail.com>
Subject: Using reference for performance gain?
Message-Id: <1152068781.872129.243570@75g2000cwc.googlegroups.com>

hi,

consider the following codes...

it is interested that there is no performance gain when we use return
by reference...or is that perl already optimized them for us?

#--------------------------------------------------------------------
sub test {
	my %h = (
				"a"	=> "asdsaefsayd7asdsdsdsdsdsdsatd7as6fdsa76smndfkjtpyty",
				"b"	=> "vdfdgdgregrehgregdsa6td76satd7as6fdsa76smndfdfdgfhf",
				"c"	=> "zxczxrhsadsadhsayd7asysgdsa6td76satd7as6fdsa76hthth",
				"d"	=> "jhthfgdsadsadhsayd7asysgdsa6td76satd7as6fdsahrhrhrh",
				"e"	=> "sfeghhfhsadsadhsayd7asysgdsa6td76satd7as6fdsahththt",
				"f"	=> "jgjgjgsadsadhsayd7asysgdsa6td76satd7as6fdseretttttg",
				"g"	=> "ekreorrsadsadhsayd7asysgdsa6td76satd7as6fdsadgdgggg",
				"h"	=> "sadsadhsayd7asysgdsa6td76satd7as6fdsa76smndfkjdfdfd",
				"i"	=> "mhjghhtsadsadhsayd7asysgdsa6td76satd7ahghghrrtrtrrt",
				"j"	=> "ewtyhrhsadsadhsayd7asysgdsa6td76satd7as6fdsa76smndf",
				"k"	=> "ykiyuiyutdhsayd7asysgdsa6td76satd7as6fdsa76smndfkjd"
	);

	# return %h;
	return \%h;
}

my $startTime = time();

for ($count=1; $count<500000; $count++) {
	my $tmp = test();
}

my $endTime = time();
print $endTime - $startTime;



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

Date: Tue, 04 Jul 2006 16:29:37 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: Which is the perl questions ng for beginners
Message-Id: <poWdnUeNzPeIZzfZnZ2dnUVZ_o2dnZ2d@comcast.com>

V S Rawat wrote:

> I have installed ActivePerl 5.8.8 build 817 on my winxp

Don't forget the built-in documentation.

Start -> All Programs -> ActivePerl -> Documentation


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

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


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