[30866] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2111 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 10 00:09:51 2009

Date: Fri, 9 Jan 2009 21:09:13 -0800 (PST)
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, 9 Jan 2009     Volume: 11 Number: 2111

Today's topics:
    Re: a homework need help <pilcrow6@gmail.com>
    Re: Circular lists xhoster@gmail.com
    Re: Installing CPAN module that has no PPM package <george@example.invalid>
    Re: Installing CPAN module that has no PPM package <tim@burlyhost.com>
    Re: Installing CPAN module that has no PPM package <tim@burlyhost.com>
    Re: opening a file <george@example.invalid>
    Re: opening a file <george@example.invalid>
    Re: opening a file <george@example.invalid>
    Re: opening a file <george@example.invalid>
    Re: opening a file <jurgenex@hotmail.com>
    Re: opening a file <jurgenex@hotmail.com>
    Re: opening a file <george@example.invalid>
    Re: opening a file <tim@burlyhost.com>
    Re: please help me to understand this code? <pilcrow6@gmail.com>
    Re: please help me to understand this code? (Tim McDaniel)
    Re: please help me to understand this code? <tadmc@seesig.invalid>
    Re: please help me to understand this code? <glex_no-spam@qwest-spam-no.invalid>
    Re: please help me to understand this code? <glex_no-spam@qwest-spam-no.invalid>
    Re: please help me to understand this code? <pilcrow6@gmail.com>
    Re: Regular Expression Question (Tim McDaniel)
    Re: Regular Expression Question <tim@burlyhost.com>
        Syntactic sugar for scope closing hook? <steve.roscio@hp.com>
    Re: Using use in programs vs modules <tadmc@seesig.invalid>
    Re: Using use in programs vs modules <tim@burlyhost.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 09 Jan 2009 20:02:19 -0800
From: Pilcrow <pilcrow6@gmail.com>
Subject: Re: a homework need help
Message-Id: <oc7gm4d7nlu1jlrnbfni99r1thr5n99ofo@4ax.com>

On Thu, 4 Dec 2008 16:38:52 -0800, "Camel" <jiao_he@sbcglobal.net>
wrote:

>I have no clue with my homework, can anyone help me?
>
>Three digits "1,2,3", how many 3-digit numbers can be made? print all the 
>numbers
>
>I know how to calculate the total numbers and using loop to print all the 
>numbers. The problem is how to write a generic program that takes any number 
>of digits. For example, if given "1,2,3,4,5" digits, you still can use your 
>program to print all the combinations of 5-digit numbers without modifing 
>it.
>
>Thanks in advance. 
>


perldoc -q permute


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

Date: 09 Jan 2009 21:12:33 GMT
From: xhoster@gmail.com
Subject: Re: Circular lists
Message-Id: <20090109161437.326$v1@newsreader.com>

Jim Gibson <jimsgibson@gmail.com> wrote:
> In article <alpine.LNX.2.00.0901091123380.580@jvz.es>, gamo
> <gamo@telecable.es> wrote:
>
> > EXAMPLE:
> >
> > I have a set of @set = qw(a a b b b c c c c);
> >
> > In a loop...
> >
> > @list = shuffle(@set);
> >
> > and I want to know how many diferent circular lists could be generated.
>
> I think you want to know how many unique permutations may be generated
> that are invariant under rotation (moving the last element to the front
> of the list any number of times).
>
> You can use the advice given in 'perldoc -q permute' to generate all
> possible permutations. Because the elements in your example are not
> unique, you will generate some permutations which are also not unique.
> If this is actually the case, then you want an efficient way of
> ignoring redundant permutations.
>
> One way would be to attach a unique key to each member of your list,
> e.g. qw( a1 a2 b3 b4 b5 c6 c7 c8 c9 ). Then, you only accept a
> permutation that has each repeated element in order. For example ( a1,
> a2, ... ) would be accepted but ( a2, a1, ... ) would be rejected. You
> apply this test for all the a's, b's, and c's in the permutation. If
> any are out of order, reject the permutation. To use the list, strip
> off the keys.

It might be possible to integrate that technique into the Fischer-Kause
algorithm so that only the unique ones are generated, rather than having
to generate, test, and discard.  Now that would be some subtle code.

>
> For the circularity problem, each permutation can be rotated to produce
> all of the equivalent cases. For N elements (9 in your sample case),
> there will be N equivalent cases. To avoid generating the redundant
> cases, select one element (e.g. a1 from your list), place it in the
> first location, and generate all possible permutations of the remaining
> N-1 elements, using the method described above if you have non-unique
> elements. The result should be all possible circular lists (if I
> understand your definition correctly).

I think this is a good start, but it still produces redundant results.

For example, if @set = qw/A A C/; # and we number the elements as you did
above, then this method will return both:

A1 A2 C1
A1 C1 A2

Which are circularly the same once the digits are removed.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.


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

Date: Fri, 9 Jan 2009 19:37:11 -0700
From: George <george@example.invalid>
Subject: Re: Installing CPAN module that has no PPM package
Message-Id: <1usvezxjureqs$.otny53u9fxhf.dlg@40tude.net>

On Fri, 09 Jan 2009 10:18:29 -0500, tbone wrote:

> I want to install the podcast aggregator modules MP3::PodcastFetch
> 
> I have ActiveState Perl 5.10, and I would like to use some CPAN
> modules that are not (yet) supported via PPM.
> 
> I've fiddled with things for a while and have arrived at what seems to
> be an impasse. I got a compatible version of nmake from MS, and I have
> Visual Studio 6 and 8 installed on this machine. But for some reason,
> I can't get the compiles to run properly.
> 
> 
> Using vcvars32.at from VS6, I get this compilerok.log file:
> 
> Command line warning D4002 : ignoring unknown option '-nodefaultlib'
> Command line warning D4002 : ignoring unknown option '-debug'
> Command line warning D4002 : ignoring unknown option
> '-libpath\:"C\:\\Perl\\lib\\CORE"'
> Command line warning D4002 : ignoring unknown option '-machine\:x86'
> compilerok.c
> LINK : LNK4073: cannot create map for .ILK file; linking
> nonincrementally
> LINK : fatal error LNK1104: cannot open file "pt\:ref\,icf.exe"
> 
> Using vcvarsall.bat from VS8, I get this compilerok.log file:
> 
> cl : Command line warning D9035 : option 'o' has been deprecated and
> will be removed in a future release
> cl : Command line warning D9002 : ignoring unknown option
> '-nodefaultlib'
> cl : Command line warning D9002 : ignoring unknown option '-debug'
> cl : Command line warning D9002 : ignoring unknown option
> '-libpath\:"C\:\\Perl\\lib\\CORE"'
> cl : Command line warning D9002 : ignoring unknown option
> '-machine\:x86'
> compilerok.c
> LINK : cannot create map for .ILK file; linking nonincrementally
> LINK : fatal error LNK1104: cannot open file 'pt\:ref\,icf.exe'
> 
> Any pointers?
> 
> Thx
> tbone

Are you on windows?
-- 
George

Any government that supports, protects or harbours terrorists is complicit
in the murder of the innocent and equally guilty of terrorist crimes.
George W. Bush

Picture of the Day http://apod.nasa.gov/apod/


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

Date: Fri, 09 Jan 2009 19:17:15 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: Installing CPAN module that has no PPM package
Message-Id: <%qU9l.834$HD7.481@newsfe25.iad>

George wrote:

> On Fri, 09 Jan 2009 10:18:29 -0500, tbone wrote:
> 
>> I want to install the podcast aggregator modules MP3::PodcastFetch
>> 
>> I have ActiveState Perl 5.10, and I would like to use some CPAN
>> modules that are not (yet) supported via PPM.
>> 
>> I've fiddled with things for a while and have arrived at what seems
>> to be an impasse. I got a compatible version of nmake from MS, and I
>> have Visual Studio 6 and 8 installed on this machine. But for some
>> reason, I can't get the compiles to run properly.
>> 
>> 
>> Using vcvars32.at from VS6, I get this compilerok.log file:
>> 
>> Command line warning D4002 : ignoring unknown option '-nodefaultlib'
>> Command line warning D4002 : ignoring unknown option '-debug'
>> Command line warning D4002 : ignoring unknown option
>> '-libpath\:"C\:\\Perl\\lib\\CORE"'
>> Command line warning D4002 : ignoring unknown option '-machine\:x86'
>> compilerok.c
>> LINK : LNK4073: cannot create map for .ILK file; linking
>> nonincrementally
>> LINK : fatal error LNK1104: cannot open file "pt\:ref\,icf.exe"
>> 
>> Using vcvarsall.bat from VS8, I get this compilerok.log file:
>> 
>> cl : Command line warning D9035 : option 'o' has been deprecated and
>> will be removed in a future release
>> cl : Command line warning D9002 : ignoring unknown option
>> '-nodefaultlib'
>> cl : Command line warning D9002 : ignoring unknown option '-debug'
>> cl : Command line warning D9002 : ignoring unknown option
>> '-libpath\:"C\:\\Perl\\lib\\CORE"'
>> cl : Command line warning D9002 : ignoring unknown option
>> '-machine\:x86'
>> compilerok.c
>> LINK : cannot create map for .ILK file; linking nonincrementally
>> LINK : fatal error LNK1104: cannot open file 'pt\:ref\,icf.exe'
>> 
>> Any pointers?
>> 
>> Thx
>> tbone
> 
> Are you on windows?

The OP said:

"I have ActiveState Perl 5.10"

"I got a compatible version of nmake from MS"

"I have Visual Studio 6 and 8 installed on this machine"

"Using vcvars32.at from VS6"

"-libpath\:"C\:\\Perl\\lib\\CORE""

"Using vcvarsall.bat from VS8"

So, these very likely are an answer that they are on a Windows system,
for future reference.
-- 
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting.  24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!


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

Date: Fri, 09 Jan 2009 19:26:38 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: Installing CPAN module that has no PPM package
Message-Id: <OzU9l.14310$H12.9954@newsfe12.iad>

tbone wrote:

> I want to install the podcast aggregator modules MP3::PodcastFetch
> 
> I have ActiveState Perl 5.10, and I would like to use some CPAN
> modules that are not (yet) supported via PPM.
> 
> I've fiddled with things for a while and have arrived at what seems to
> be an impasse. I got a compatible version of nmake from MS, and I have
> Visual Studio 6 and 8 installed on this machine. But for some reason,
> I can't get the compiles to run properly.
> 
> 
> Using vcvars32.at from VS6, I get this compilerok.log file:
> 
> Command line warning D4002 : ignoring unknown option '-nodefaultlib'
> Command line warning D4002 : ignoring unknown option '-debug'
> Command line warning D4002 : ignoring unknown option
> '-libpath\:"C\:\\Perl\\lib\\CORE"'
> Command line warning D4002 : ignoring unknown option '-machine\:x86'
> compilerok.c
> LINK : LNK4073: cannot create map for .ILK file; linking
> nonincrementally
> LINK : fatal error LNK1104: cannot open file "pt\:ref\,icf.exe"
> 
> Using vcvarsall.bat from VS8, I get this compilerok.log file:
> 
> cl : Command line warning D9035 : option 'o' has been deprecated and
> will be removed in a future release
> cl : Command line warning D9002 : ignoring unknown option
> '-nodefaultlib'
> cl : Command line warning D9002 : ignoring unknown option '-debug'
> cl : Command line warning D9002 : ignoring unknown option
> '-libpath\:"C\:\\Perl\\lib\\CORE"'
> cl : Command line warning D9002 : ignoring unknown option
> '-machine\:x86'
> compilerok.c
> LINK : cannot create map for .ILK file; linking nonincrementally
> LINK : fatal error LNK1104: cannot open file 'pt\:ref\,icf.exe'
> 
> Any pointers?
> 
> Thx
> tbone

Are you able to compile/build other modules okay?  It is interesting to
note that it's showing it can't open 'pt\:ref\,icf.exe'.  That should
be '\opt\:ref\,icf.exe' (opt, rather than pt).  Can you remove those
switches from the CL (CL.EXE) command line, maybe to LINK(.EXE)? 
Sorry, I've not used Windows for over a decade now, so my suggestion
might not help.
-- 
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting.  24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!


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

Date: Fri, 9 Jan 2009 18:28:14 -0700
From: George <george@example.invalid>
Subject: Re: opening a file
Message-Id: <eip7l0zr2vk.vbo96zr8azgm$.dlg@40tude.net>

On Thu, 08 Jan 2009 21:25:17 +1300, Ryan McCoskrie wrote:

> George wrote:

> 
> This is all that you need
> 
> #The manuals don't really say it but files have their own data type.
> #This line creates a variable called file or exits saying that it can't open
> #the file with a possible explanation (the $! variable).
> open( FILE, "ehp4.txt") || die "Could not open ehp3.txt $!";
> 
> #read out one line at a time until the file ends
> while( <FILE> ){
> 	print $_; #If you don't specify a file it goes to STDOUT (STandard OUTput)
> 	#The $_ variable is created by the while statement

I didn't know that.


> }
> 
> close(FILE); #This might not really be needed
> 
> 
> On Unix type systems (Linux and BSD are not called Unix for legal reasons)
> all programs are told about a set of files called stdin, stdout and stderr.
> These act as the command line input / output (the last one is to prevent
> error messages from being confused with normal output).
> 
> If you have a choice try switching over to Linux (FreeBSD later perhaps) and
> do your programming their. Most of the perl concepts come from that sort
> of environment.
> I would describe my system (running Fedora Linux version 10) as a born as
> PC and perl fits in very well.
> The GNU Compiler Collection also has optional FORTRAN support.

Thanks for your response, Ryan.  What do you mean by this?  I'm well
acquainted with the gfortran and g95 folks; indeed, I use their compilers.
Do you mean support that doesn't take the form of a compiler?

I ran the script in the same directory as the target, and I missed:
		
C:\MinGW\source>perl faulk1.pl
Could not open ehp3.txt No such file or directory at faulk1.pl line 4.

C:\MinGW\source>dir
 Volume in drive C has no label.
 Volume Serial Number is 942A-AD55

 Directory of C:\MinGW\source


01/04/2009  07:50 PM               566 eph3.txt
01/05/2009  01:57 PM             1,576 eph4.f03
01/06/2009  10:51 PM               532 eph4.txt
01/05/2009  02:11 PM             1,567 eph5.f03
01/06/2009  10:56 PM               730 eph6.f03
01/06/2009  11:15 PM               852 eph7.f03
01/06/2009  04:43 PM               465 eps1.f03
11/27/2003  02:31 PM            13,333 f2kcli.f90
12/14/2008  01:28 PM             2,662 f2kcli.mod
01/09/2009  06:18 PM               538 faulk1.pl
01/30/2000  03:19 PM             1,276 fax.h


C:\MinGW\source>

Any ideas?
-- 
George

Bring them on.
George W. Bush

Picture of the Day http://apod.nasa.gov/apod/


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

Date: Fri, 9 Jan 2009 18:44:17 -0700
From: George <george@example.invalid>
Subject: Re: opening a file
Message-Id: <1p6xixesax77i$.1nvhr8dntnmem$.dlg@40tude.net>

On Thu, 08 Jan 2009 09:04:21 +0100, Mirco Wahab wrote:

>    open(50, '<ehp3.txt');
>    DO:
>      { my $line = readline(*50);
>        if(eof != 0) { exit }
>        print $line;         # no 'write' here
>    redo DO }                # no 'end' possible
>    close(50)

Shoot, I get nothing for output here.  I added asymbol to yours, but I
still get nothing.  I have to believe that USER ERROR is rearing its head
and laughing at me.

   open(50, '<ehp3.txt>');
   DO:
     { my $line = readline(*50);
       if(eof != 0) { exit }
       print $line;         # no 'write' here
   redo DO }                # no 'end' possible
   close(50)

# perl faulk3.pl


C:\MinGW\source>perl faulk1.pl
Could not open ehp3.txt No such file or directory at faulk1.pl line 4.
             
11/30/2008  01:54 AM                17 dump.bat
12/13/2008  01:13 PM                 0 e
12/13/2008  01:07 PM           455,220 e.exe
02/06/2000  11:00 AM            18,733 encode.c
12/06/2008  08:18 PM            18,763 encode1.c
12/31/2008  07:14 PM                79 eph1.f03
12/31/2008  06:32 PM             1,098 eph1.txt
01/02/2009  12:43 AM               672 eph2.f03
12/31/2008  06:52 PM               217 eph2.txt
01/03/2009  07:23 PM             1,807 eph3.f03
01/04/2009  07:50 PM               566 eph3.txt
01/05/2009  01:57 PM             1,576 eph4.f03
01/06/2009  10:51 PM               532 eph4.txt
01/05/2009  02:11 PM             1,567 eph5.f03
01/06/2009  10:56 PM               730 eph6.f03
01/06/2009  11:15 PM               852 eph7.f03
01/06/2009  04:43 PM               465 eps1.f03
11/27/2003  02:31 PM            13,333 f2kcli.f90
12/14/2008  01:28 PM             2,662 f2kcli.mod
01/09/2009  06:18 PM               538 faulk1.pl
01/30/2000  03:19 PM             1,276 fax.h
12/12/2008  08:51 PM             2,719 fin1.txt
12/30/2008  10:41 PM             7,683 frank1.txt
01/07/2009  02:24 AM             6,879 frank2.txt

C:\MinGW\source>perl faulk2.pl
unable to open 'ehp3.txt' because No such file or directory at faulk2.pl
line 6.


C:\MinGW\source>perl faulk2.pl
unable to open 'ehp3.txt' because No such file or directory at faulk2.pl
line 6.


C:\MinGW\source>perl faulk3.pl

C:\MinGW\source>perl faulk3.pl

C:\MinGW\source>

??:-(\
-- 
George

The United States and our allies are determined: we refuse to live in the
shadow of this ultimate danger.
George W. Bush

Picture of the Day http://apod.nasa.gov/apod/


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

Date: Fri, 9 Jan 2009 18:54:09 -0700
From: George <george@example.invalid>
Subject: Re: opening a file
Message-Id: <lxb54ymwwaep.1a82pnj0dy7dq.dlg@40tude.net>

On Fri, 09 Jan 2009 12:09:43 +0100, Dr.Ruud wrote:

>   ./filter.pl


C:\MinGW\source>  ./filter.pl
'.' is not recognized as an internal or external command,
operable program or batch file.

C:\MinGW\source>
-- 
George

Freedom itself was attacked this morning by a faceless coward, and freedom
will be defended.
George W. Bush

Picture of the Day http://apod.nasa.gov/apod/


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

Date: Fri, 9 Jan 2009 19:17:51 -0700
From: George <george@example.invalid>
Subject: Re: opening a file
Message-Id: <v76wxj55e5rk.yd6s44b1edc4.dlg@40tude.net>

On Wed, 7 Jan 2009 20:57:31 -0800, Keith Keller wrote:

> perldoc -q 'entire file'

Keith,

I seem completely befuddled by bonehead stuff here.  An example is that dos
gives me nothing for perldoc; what's more, I find options on the net that
don't seem to be as simple as this task must be.

http://perldoc.perl.org/File/Find.html

OTOH, maybe perl has completely different notions.  I'm quite clueless
here.  What can I say: I'm George.
-- 
George

You can fool some of the people all the time, and those are the ones you
want to concentrate on.
George W. Bush

Picture of the Day http://apod.nasa.gov/apod/


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

Date: Fri, 09 Jan 2009 18:24:38 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: opening a file
Message-Id: <1h1gm4hiil30nlesvkic1jt2bkage3s541@4ax.com>

George <george@example.invalid> wrote:
>Shoot, I get nothing for output here.  I added asymbol to yours, but I
>still get nothing.  I have to believe that USER ERROR is rearing its head
>and laughing at me.
>
>   open(50, '<ehp3.txt>');
>   DO:
>     { my $line = readline(*50);
>       if(eof != 0) { exit }
>       print $line;         # no 'write' here
>   redo DO }                # no 'end' possible
>   close(50)

Ouch! This hurts! I suppose some people manage to program in Fortran no
matter what programming language they are using.

>Could not open ehp3.txt No such file or directory at faulk1.pl line 4.
                ^^^^^^^^  
[...]
>01/04/2009  07:50 PM               566 eph3.txt
                                        ^^^^^^^^

Dah!

jue
   


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

Date: Fri, 09 Jan 2009 18:30:49 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: opening a file
Message-Id: <a12gm49p8bmbocajvc059otfo4p744f059@4ax.com>

George <george@example.invalid> wrote:
>On Fri, 09 Jan 2009 12:09:43 +0100, Dr.Ruud wrote:
>
>>   ./filter.pl
>
>
>C:\MinGW\source>  ./filter.pl
>'.' is not recognized as an internal or external command,
>operable program or batch file.

You might want to learn how to use your OS/command shell.

	.\filter.pl

jue


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

Date: Fri, 9 Jan 2009 20:11:49 -0700
From: George <george@example.invalid>
Subject: Re: opening a file
Message-Id: <stix5ox8lhmi$.mwfm0ismmwzu.dlg@40tude.net>

On Fri, 09 Jan 2009 18:24:38 -0800, Jürgen Exner wrote:

> George <george@example.invalid> wrote:
>>Shoot, I get nothing for output here.  I added asymbol to yours, but I
>>still get nothing.  I have to believe that USER ERROR is rearing its head
>>and laughing at me.
>>
>>   open(50, '<ehp3.txt>');
>>   DO:
>>     { my $line = readline(*50);
>>       if(eof != 0) { exit }
>>       print $line;         # no 'write' here
>>   redo DO }                # no 'end' possible
>>   close(50)
> 
> Ouch! This hurts! I suppose some people manage to program in Fortran no
> matter what programming language they are using.

That's what they say about fortran, is that you do it in any syntax.  If
you don't eventually "give in" to the ethos of a scripting language, you
miss the better part of it.  Wir meinen damit daß das abwertend ist,
fortran sonstwo zu üben.

For example, there's one line in a perl script.  Mirko's script does well
to entertain my previous notions here.  In particular, the unit number in
fortran looks like it works as a file handle for perl.  Am I correct that
50 is a perfectly kosher fh here.

That the read avails itself of fifty with one level of indirection is
something that one might expect of a child of C.

> 
>>Could not open ehp3.txt No such file or directory at faulk1.pl line 4.
>                 ^^^^^^^^  
> [...]
>>01/04/2009  07:50 PM               566 eph3.txt
>                                         ^^^^^^^^
> 
> Dah!
> 
> jue

Ich bin ahnungslos:

C:\MinGW\source>perldoc -q 'entire file'
No documentation for perl FAQ keyword `'entire' found

C:\MinGW\source>perl faulk3.pl

C:\MinGW\source>type eph3.txt
! yesterday
# another comment

Sun     18h 41m 55s     -23â–‘ 5.4'       0.983   10.215  52.155  Up
Mercury 20h 2m 16s      -22â–‘ 12.5'      1.102   22.537  37.668  Up
Venus   21h 55m 33s     -14â–‘ 16.3'      0.795   39.872  11.703  Up
Moon    21h 17m 19s     -15â–‘ 2.4'       62.4 ER 36.796  22.871  Up
Mars    18h 11m 59s     -24â–‘ 6.1'       2.431   4.552   56.184  Up
Jupiter 20h 3m 35s      -20â–‘ 49.4'      6.034   23.867  38.203  Up
Saturn  11h 32m 59s     +5â–‘ 8.6'        9.018   -47.333 157.471 Set
Uranus  23h 21m 30s     -4â–‘ 57.9'       20.421  48.328  -18.527 Up
Neptune 21h 39m 30s     -14â–‘ 22.8'      30.748  38.963  16.599  Up
Pluto   18h 4m 34s      -17â–‘ 44.5'      32.543  7.443   62.142  Up

C:\MinGW\source>type faulk3.pl
   open(50, '<eph3.txt>');
   DO:
     { my $line = readline(*50);
       if(eof != 0) { exit }
       print $line;         # no 'write' here
   redo DO }                # no 'end' possible
   close(50)

# perl faulk3.pl
C:\MinGW\source>


-- 
George

I believe the most solemn duty of the American president is to protect the
American people. If America shows uncertainty and weakness in this decade,
the world will drift toward tragedy. This will not happen on my watch.
George W. Bush

Picture of the Day http://apod.nasa.gov/apod/


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

Date: Fri, 09 Jan 2009 19:13:46 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: opening a file
Message-Id: <KnU9l.833$HD7.690@newsfe25.iad>

George wrote:

>  ran the script in the same directory as the target, and I missed:
> 
> C:\MinGW\source>perl faulk1.pl
> Could not open ehp3.txt No such file or directory at faulk1.pl line 4.
> 
> C:\MinGW\source>dir
> Volume in drive C has no label.
> Volume Serial Number is 942A-AD55
> 
> Directory of C:\MinGW\source
> 
> 
> 01/04/2009  07:50 PM               566 eph3.txt

> 
> 
> C:\MinGW\source>
> 
> Any ideas?

yes, eph.txt and ehp.txt are not the same file name.
-- 
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting.  24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!


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

Date: Fri, 09 Jan 2009 13:44:30 -0800
From: Pilcrow <pilcrow6@gmail.com>
Subject: Re: please help me to understand this code?
Message-Id: <eegfm4lkf3ikacp4ddcdrlveuo0l8n2ec2@4ax.com>

On Fri, 9 Jan 2009 12:48:28 -0800 (PST), cartercc <cartercc@gmail.com>
wrote:

>On Jan 9, 1:21 pm, Pilcrow <pilcr...@gmail.com> wrote:
>> Sorry to have disturbed Your Majesty
>
>I suppose
>that G got what he deserved by casting his pearls before swine, or a
>swine, which is exactly what you seem by your response. 

I don't remember using language remotely as offensive as yours, but
perhaps you have not got the mental facility to insult a person without
yourself crawling into the gutter.  

I was sarcastic..  I was not insulting.  I am capable, in several
languages, of saying extremely insulting, vile, things.  But then, I
would become your comrade in filth, and I prefer not to.


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

Date: Fri, 9 Jan 2009 22:19:15 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: please help me to understand this code?
Message-Id: <gk8ih3$r8j$1@reader1.panix.com>

In article <eegfm4lkf3ikacp4ddcdrlveuo0l8n2ec2@4ax.com>,
Pilcrow  <pilcrow6@gmail.com> wrote:
>I was sarcastic.  I was not insulting.

The American Heritage dictionary defines sarcasm as "1. A cutting,
often ironic remark intended to wound. ... intended to make its victim
the butt of contempt or ridicule.".

I too perceived you as being insulting.  And "look up the algorithm
and dump data while the Perl code executes" is an appropriate first
answer.

-- 
Tim McDaniel, tmcd@panix.com


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

Date: Fri, 9 Jan 2009 17:03:41 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: please help me to understand this code?
Message-Id: <slrngmflud.phv.tadmc@tadmc30.sbcglobal.net>

Tim McDaniel <tmcd@panix.com> wrote:
> In article <eegfm4lkf3ikacp4ddcdrlveuo0l8n2ec2@4ax.com>,
> Pilcrow  <pilcrow6@gmail.com> wrote:
>>I was sarcastic.  I was not insulting.
>
> The American Heritage dictionary defines sarcasm as "1. A cutting,
> often ironic remark intended to wound. ... intended to make its victim
> the butt of contempt or ridicule.".
>
> I too perceived you as being insulting.  


So did I. 

I have taken the appropriate steps.


> And "look up the algorithm
> and dump data while the Perl code executes" is an appropriate first
> answer.


Even more appropriate was

   If so, what
   parts are you not understanding?  What parts _do_ you understand?
   Knowing this will be helpful to giving you the best answer, without
   anyone having to go into great detail or explain every aspect


Surely we weren't expected to

   > my $code = shift;

   my declares a variable.
   = is an assignment, it stores the expr on the RHS into the 
     variable on the LHS
   shift() with no arguments shifts @_ when called in a subroutine

   so altogether, that line stores the subroutine's 1st arg in $code.

   > my @idx = 0..$#_;

   .. is the range operator it creates a list that goes up by 1 starting
      from its left operand and ending with its right operand

   $#ARRAYNAME returns the last index of the @ARRAYNAME array

   etc...
 

-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Fri, 09 Jan 2009 17:46:42 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: please help me to understand this code?
Message-Id: <4967e1e2$0$89395$815e3792@news.qwest.net>

Pilcrow wrote:
> On Thu, 08 Jan 2009 13:59:26 -0600, "J. Gleixner"
> <glex_no-spam@qwest-spam-no.invalid> wrote:
> 
>> Pilcrow wrote:
>>> The following is part of faq 4.51.  I am afraid that a good deal of it
>>> is beyond my understanding, and, I suspect, beyond the understaning of a
>>> good many others who read clpm.  It works, but I don't know how. Perhaps
>>> some genius will explain it, line by line, to me and the other dummies.
>> A lot can be discovered on your own by using print and/or
>> Data::Dumper.  Add a few calls to print or Dumper, to see
>> various values, to help you see what's happening. If
>> you have a specific question about a certain line/syntax,
>> then ask.
>>
>>> Perhaps someone will also tell me the source for "The Fischer-Krause
>>> Algorithm", since TAOCP, vol 4 is still unpublished?
>> Perhaps you can find that on your own using your favorite Internet 
>> search engine?
>>
>> Using on returned: "Results 1 - 10 of about 393 for Fischer-Krause 
>> algorithm.", so there are a lot of possible pages to read.
> 
> Sorry to have disturbed Your Majesty
> 

Why post a question here and wait for hours/days to possibly get
a reply when you can do most of it on your own, in seconds?

Posting to a newsgroup should not be your first stop when you
have a question.  Knowing how to debug code or how to read books
or even how to type three words into your favorite search engine
are useful skills.




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

Date: Fri, 09 Jan 2009 18:31:17 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: please help me to understand this code?
Message-Id: <4967ec56$0$89385$815e3792@news.qwest.net>

cartercc wrote:
> On Jan 9, 1:21 pm, Pilcrow <pilcr...@gmail.com> wrote:
>> Sorry to have disturbed Your Majesty
> 
> You have needlessly offended two people who regularly post to c.l.p.m.
> and prove helpful on a regular basis. If you have read this group for
> a while, you know that the usual method of 'helping' is to point those
> who ask for help to the appropriate resources. The theory is that
> those needing help also need to learn how to help themselves. I
> thought G's advice was very good. You need to know how to use Data
> Dumper, and you need to know how to print intermediate values from
> your programs. These are pearls (or perls) of wisdom, but I suppose
> that G got what he deserved by casting his pearls before swine, or a
> swine, which is exactly what you seem by your response. My guess is
> that he will be reluctant to respond to your posts in the future,
> which is very much to your loss.

Nah, I just laugh, and wonder how some people never learn to
do anything on their own.  Either that or it's their
first day using this here Internet/Usenet thingamajig.

> 
> My response to your question is similar: type the code into your
> interpreter and see how it runs. Except I would have recommended using
> the Perl debugger ... run the program with the -d switch.

Yeah, I was going to suggest that, however if someone doesn't know
that they can use a few calls to 'print' in their code to help them
see what it's doing, then the debugger is likely a few levels
above their knowledge of the language.

> 
> The proverb is: Give a hungry man a fish and you feed him for a day;
> teach him to fish and you feed him for a lifetime. Except in you case
> it becomes: Set a cold man before a fire and you warm him for an hour;
> set him on fire and you warm him for a lifetime.
> 
> CC


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

Date: Fri, 09 Jan 2009 18:02:06 -0800
From: Pilcrow <pilcrow6@gmail.com>
Subject: Re: please help me to understand this code?
Message-Id: <lpmfm415v8lvcgvt9gfqj5jd7coadl6aem@4ax.com>

On Fri, 9 Jan 2009 22:19:15 +0000 (UTC), tmcd@panix.com (Tim McDaniel)
wrote:

>In article <eegfm4lkf3ikacp4ddcdrlveuo0l8n2ec2@4ax.com>,
>Pilcrow  <pilcrow6@gmail.com> wrote:
>>I was sarcastic.  I was not insulting.
>
>The American Heritage dictionary defines sarcasm as "1. A cutting,
>often ironic remark intended to wound. ... intended to make its victim
>the butt of contempt or ridicule.".

After consulting Merriam-Webster  online, I see that I was being
ironic,rather than sarcastic.  I seem often to confuse the two.  It was
not my intention to insult, but the boor who called me a 'swine'
intended insult.




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

Date: Fri, 9 Jan 2009 22:31:02 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: Regular Expression Question
Message-Id: <gk8j76$r8j$2@reader1.panix.com>

In article <bOM9l.2462$1k1.689@newsfe14.iad>,
Tim Greer  <tim@burlyhost.com> wrote:
>Börni wrote:
>
>> Thank you very much for your help everybody! (Of course my problem was
>> the ">" character)
>
>(top posting fixed)
>
>Actually, the problem wasn't the ">" character.  The problem was that
>the match went all the way to the last character, which happened to be
>the > character.  The actual problem was that it was grabbing
>everything from the content's opening double quote content=" (.*?) all
>the way to ending ">, which happened to be " lang="fr.

No, he's right: the problem was that '>' was in the regexp.
    .*?
is non-greedy matching.  If the terminal '>' had not been in the
regexp, it would have stopped at the second ".

-- 
Tim McDaniel, tmcd@panix.com


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

Date: Fri, 09 Jan 2009 15:43:52 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: Regular Expression Question
Message-Id: <_iR9l.17645$pe.2786@newsfe13.iad>

Tim McDaniel wrote:

> In article <bOM9l.2462$1k1.689@newsfe14.iad>,
> Tim Greer  <tim@burlyhost.com> wrote:
>>Börni wrote:
>>
>>> Thank you very much for your help everybody! (Of course my problem
>>> was the ">" character)
>>
>>(top posting fixed)
>>
>>Actually, the problem wasn't the ">" character.  The problem was that
>>the match went all the way to the last character, which happened to be
>>the > character.  The actual problem was that it was grabbing
>>everything from the content's opening double quote content=" (.*?) all
>>the way to ending ">, which happened to be " lang="fr.
> 
> No, he's right: the problem was that '>' was in the regexp.
>     .*?
> is non-greedy matching.  If the terminal '>' had not been in the
> regexp, it would have stopped at the second ".
> 

I suppose it's just a matter of wording it.  I read it as the OP meaning
it was the character, rather than the formatting of the regex and the
location of it.  I just think the preferable way would be to match with
([^"]*), but I suppose it's up to the individual.
-- 
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting.  24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!


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

Date: Fri, 09 Jan 2009 15:08:11 -0700
From: Steve Roscio <steve.roscio@hp.com>
Subject: Syntactic sugar for scope closing hook?
Message-Id: <gk8hsb$mcr$1@usenet01.boi.hp.com>

Howdy -

I have a module where its functions work in pairs: an opening and 
closing pairs.  Because it's likely that these functions will be used 
where the programmer also uses exceptions (eval/die), or just wants to 
be lazy, it's important that the close function is always called when 
exiting the enclosing scope.  I find it tedious to track down every 
possible exit path and include the closure.

The simple way to achieve this is to create and object and have a 
DESTROY method for it:
	{
	my $trak = function_returning_some_object (args...);
	. . .
	} 	# DESTROY() method called here, invokes close function

That's OK, but I'd like to take it to the next level and make it 
syntactically look nicer.  Some sugar, if you will.  I want to just do this:

	{
	blah args...;   # blah creates object in *current* scope
	. . .
	}		# Closure for 'blah' object called

How can I do this?

I've had some success by stuffing a closure (with a DESTROY) into the 
caller(1)'s symbol glob.  But that only handles the case when the scope 
is the enclosing sub.  How do I do this for local scopes created simply 
by pairs of { }'s ?

I've also done source filters that simply convert the sugar-coated form 
into the primitive form.  But that feels evil.

Thanx in advance,
- Steve

PS:  Sorry, I know I'm not explaining this well.  I hope you can get the 
gist of it.


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

Date: Fri, 9 Jan 2009 16:47:15 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Using use in programs vs modules
Message-Id: <slrngmfkvj.op1.tadmc@tadmc30.sbcglobal.net>

pgodfrin <pgodfrin@gmail.com> wrote:

> I have little module, MyUtil.pm for example, that has utility
> functions I use in most of my perl programs. I would like to use one
> function from this module in another module - while at the same time
> referring to the same module subroutine in the "calling" perl program.
> For example
>
> The module (pseudo-code):
> package MyNewModule

> use MyUtill qw(mytool);
           ^^
           ^^ oops

> sub test_it {
>    mytool();


This is simply a shorthand way of writing:

   MyNewModule::mytool();   # assuming MyUtil @ISA Exporter

which is also equivalent to:

   MyUtil::mytool();        # no exporting needed


> The perl program (psuedo again):


There is no psuedo-ness to it. It is Real Perl Code(tm).


> use MyUtill qw(mytool);

> print mytool();


This is simply a shorthand way of writing:

    print main::mytool();

which is also equivalent to:

   MyUtil::mytool();


> This seems to work. I wonder though - is this bad form? Or does the
> internal name space stuff keep it all straight?


The name space stuff keeps it all straight.


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Fri, 09 Jan 2009 15:32:26 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: Using use in programs vs modules
Message-Id: <f8R9l.17334$pe.13422@newsfe13.iad>

pgodfrin wrote:

> This seems to work. I wonder though - is this bad form? Or does the
> internal name space stuff keep it all straight?

That depends, if the functions are unique enough and you know no one
else will be trying to figure out the code later, or that you won't
forget (though comments help a lot in that way).  Still, it's a lot
easier when you use the right name spaces and know exactly what
function is from what module sometimes.  Either way can work, but if
it's a large program that will end up with a lot of modules and
functions and you risk some similar or same function name, then you
have to start using name spaces to not cause conflicts.
-- 
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting.  24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!


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

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 V11 Issue 2111
***************************************


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