[24219] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6411 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 19 14:06:51 2004

Date: Mon, 19 Apr 2004 11:05:48 -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           Mon, 19 Apr 2004     Volume: 10 Number: 6411

Today's topics:
    Re: $1 <nobull@mail.com>
    Re: 3x3 simple puzzle <budman@somewhere.net>
    Re: alternative to "cwd()" <Joe.Smith@inwap.com>
    Re: alternative to "cwd()" <Joe.Smith@inwap.com>
    Re: alternative to "cwd()" (Walter Roberson)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 16 Apr 2004 17:10:05 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: $1
Message-Id: <u9pta752g2.fsf@wcl-l.bham.ac.uk>

anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:

> Jeff Thies <nospam@nospam.net> wrote in comp.lang.perl.misc:

> >         [...] $1, $2 ...?
> > 
> > Is there a way to localize that,
> 
> [...] they are automatically localized to the surrounding block.

Which means you can simply enclose code in { } to localize $1 etc.

It should however be noted that this localization is not the same as
sio done by local().  Importantly if you create an alias to $1 it will
still point to the current $1 even inside a different block.

This is why is it unwise to pass $1 as an argument to a subroutine.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Sat, 17 Apr 2004 19:47:51 -0300
From: budman <budman@somewhere.net>
Subject: Re: 3x3 simple puzzle
Message-Id: <pan.2004.04.17.22.47.50.33928@somewhere.net>

On Wed, 14 Apr 2004 13:55:26 +0200, Matija Papec wrote:


> I think you could make optimization if you move cards instantly without
> building all combinations first, something like,
> permute(\&CheckTiles, 0 .. 8);
> 

Hmm will take a look at it.

>>I was able to get it to solve and find the 2 solutions in 20 seconds on a
>>1.8Ghz.
>>
>>Grid: 3 x 3  Tiles: 9
>>Possibilities found: 362880
>>Solution 1: 3 0 5 8 2 7 1 4 6
>>Solution 2: 3 0 4 8 2 7 1 5 6
> 
> That's it, only notice that 4th and 5th cards (that's 5th and 6th on my
> picture) are identical so I guess these two can be considered as first
> solution. There is one more but it requires some card rotation.

Ah, I was treating it as if tiles were fixed. Sort of like those little
toys moving the squares. :)   I forgot to adjust the indexes up by one to
match the deck.

Hmm.. thinking of how to add rotation checks. :) 

> 
>>Enjoyed the puzzle. :)  
> 
> Yes, it's more fun to do it in perl rather then embarrassing yourself with
> cards in front of young nephew. :-)
> 

hehe.  Looking at the turtles is like that old X game... with the numbers
on each tile, tetravex..   

> 
> here is my solution,
> http://globalnet.hr/~mpapec/perl/turtles.txt

Will check it out.

Rich


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

Date: Mon, 19 Apr 2004 00:50:01 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: alternative to "cwd()"
Message-Id: <ZmFgc.167612$JO3.97947@attbi_s04>

Brian McGonigle wrote:

> "$currDir = $ENV{PWD}" works on unix/linux and maybe MacOS X, I heard it 
> was unix-based.

The value in $ENV{PWD} may or may not be accurate, depending on
what shell was being used at the time the perl program was started.
It is very often wrong when invoked via cron or as a CGI.
It is definitely wrong if a chdir() is earlier in the script.
	-Joe


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

Date: Mon, 19 Apr 2004 00:54:03 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: alternative to "cwd()"
Message-Id: <LqFgc.164938$K91.421565@attbi_s02>

Sunil wrote:

>     I cannot change @INC by setting the value of  PERL5LIB. or do a  "use
> lib ..."

Horsepucky.  You can always change @INC.

Perhaps you meant "Changing $ENV{PERL5LIB} appears to have no
affect on @INC", which is true if you forget to use a BEGIN block.

Have you tried this:
   BEGIN {
      $ENV{PERL5LIB} = "/primary/perl/lib";
      push @INC,"/primary/perl/lib/subdir";
   }
   use Cwd;

	-Joe


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

Date: 19 Apr 2004 01:05:34 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: alternative to "cwd()"
Message-Id: <c5v8ku$t3i$1@canopus.cc.umanitoba.ca>

In article <LqFgc.164938$K91.421565@attbi_s02>,
Joe Smith  <Joe.Smith@inwap.com> wrote:
:Have you tried this:
:   BEGIN {
:      $ENV{PERL5LIB} = "/primary/perl/lib";
:      push @INC,"/primary/perl/lib/subdir";
:   }
:   use Cwd;

Any particular reason you used double-quotes instead of single-quotes?

-- 
Take care in opening this message: My grasp on reality may have shaken
loose during transmission!


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

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


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