[19816] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2011 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 25 18:05:43 2001

Date: Thu, 25 Oct 2001 15:05:15 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1004047515-v10-i2011@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 25 Oct 2001     Volume: 10 Number: 2011

Today's topics:
        At compile time Perl thinks $ is % <lmoran@wtsg.com>
    Re: At compile time Perl thinks $ is % <tsee@gmx.net>
    Re: At compile time Perl thinks $ is % <tony_curtis32@yahoo.com>
    Re: At compile time Perl thinks $ is % (John J. Trammell)
    Re: At compile time Perl thinks $ is % <lmoran@wtsg.com>
        create tarball of perl (liping zhang)
        current dir location? <mto@kabelfoon.nl>
    Re: Debugging Perl for Unix Cobalt <yanoff@yahoo.com>
    Re: Difference between " and ' (Tad McClellan)
    Re: Difference between " and ' <bart.lateur@skynet.be>
    Re: executing a perl script <loudawg98@hotmail.com>
    Re: getting %errorlevel% values with perl? <e_kelleher@hotmail.com>
    Re: getting %errorlevel% values with perl? <darkon@one.net>
        handling numbers with leading zeros <zkent@adelphia.net>
    Re: handling numbers with leading zeros <Laocoon@eudoramail.com>
    Re: implicit split to @_ (Andrew J. Perrin)
    Re: implicit split to @_ <Tassilo.Parseval@post.rwth-aachen.de>
    Re: implicit split to @_ (Tad McClellan)
    Re: implicit split to @_ (Tad McClellan)
    Re: lookingglass.pl (Mark Jason Dominus)
    Re: modification times on Windows files (Fredrik)
        New user question <robtmil@ptd.net>
    Re: one-liner solution sought (Logan Shaw)
    Re: Ordering pairs of links [a bit long] <bart.lateur@skynet.be>
        Perl + Cygwin + CRLF issues <my full name @ yahoo  .  com>
    Re: Perl + Cygwin + CRLF issues <rereidy@indra.com>
    Re: Perl + Cygwin + CRLF issues <my full name @ yahoo  .  com>
    Re: Perl Vs. Java <anomie@my-deja.com>
    Re: Perl, MySQL, MS Access, Windows AND Linux <william-seeley@home.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 25 Oct 2001 15:36:08 -0400
From: Lou Moran <lmoran@wtsg.com>
Subject: At compile time Perl thinks $ is %
Message-Id: <j3qgtt818s9tmcp3vofv42ruolqmg5qolg@4ax.com>

#! /usr/bin/perl -w
use strict ;
use diagnostics ;

open (KEY, '<c:\dir\key.txt') or die "Can't open file $!" ; 
#open a file for reading
open (FILE1, '<c:\dir\file1.txt') or die "Can't open file: $!" ; 
#open a file for reading
open (MATCH, '>>c:\dir\match.txt') or die "Can't open file: $!" ;
#create/open file
open (EXCEPT, '>>c:\dir\exception.txt') or die "Can't open file: $!" ;
#create/open file

     my %key = <KEY> ; 
     my @file1 = <FILE1> ;
     my $match = <MATCH> ;
     my $exception = <EXCEPT> ;
     
     foreach (keys %key) {
          push (@file1, $_) if exists $match{$_} ; 
                    print $match ;
		    #this is here to see if anything happened
	  }
     foreach (keys %key) {
          push (@file1, $_) unless exists $exception{$_} ;
                    print $exception ; 
                    #this is here to see if anything happened
          }


     
close KEY or die "Can't close file: $!" ;
close FILE1 or die "Can't close file: $!" ;
close MATCH or die "Can't close file: $!" ;
close EXCEPT or die "Can't close file: $!" ;


--

This code produces the errors:

Uncaught exception from user code:
Global symbol "%match" requires explicit package name at comp.pl line
16.
Global symbol "%exception" requires explicit package name at comp.pl
line 20.
Execution of comp.pl aborted due to compilation errors.

I imagine that the above code won't even do the comparing I'm trying
to get it to do but these errors don't make sense to me.  

Why does Perl think that $match and $exception are hashes?

(note sig)

--
TMTOWTDI: My way tends to be wrong...
lmoran@wtsg.com


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

Date: Thu, 25 Oct 2001 21:44:31 +0200
From: "Steffen Müller" <tsee@gmx.net>
Subject: Re: At compile time Perl thinks $ is %
Message-Id: <9r9pvl$4op$02$1@news.t-online.com>

"Lou Moran" <lmoran@wtsg.com> schrieb im Newsbeitrag
news:j3qgtt818s9tmcp3vofv42ruolqmg5qolg@4ax.com...
| #! /usr/bin/perl -w
| use strict ;
| use diagnostics ;
|
| open (KEY, '<c:\dir\key.txt') or die "Can't open file $!" ;
| #open a file for reading
| open (FILE1, '<c:\dir\file1.txt') or die "Can't open file: $!" ;
| #open a file for reading
| open (MATCH, '>>c:\dir\match.txt') or die "Can't open file: $!" ;
| #create/open file
| open (EXCEPT, '>>c:\dir\exception.txt') or die "Can't open file: $!" ;
| #create/open file
|
|      my %key = <KEY> ;
|      my @file1 = <FILE1> ;
|      my $match = <MATCH> ;

You read from a filehandle you opened for appending, don't you? Isn't that
*wrong*?
Just an idea, though.

HTH,
Steffen
--
$_=q;33352987319029872958319011313364356732192639127636833335345138283712
3712336415083973397340602842912;;s;\n;;;print"\n";$o=$_;push@o,substr($o,
$_*4,4)for(0..24);pop@o;for(@o){$i++;print' 'x(26-$i).(chr$_/29-$i)."\n"}





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

Date: Thu, 25 Oct 2001 14:48:07 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: At compile time Perl thinks $ is %
Message-Id: <873d47a4co.fsf@limey.hpcc.uh.edu>

>> On Thu, 25 Oct 2001 15:36:08 -0400,
>> Lou Moran <lmoran@wtsg.com> said:

> $match{$_} ;
> $exception{$_} ;

> Why does Perl think that $match and $exception are
> hashes?

You're using them as hashes (with key $_).

hth
t
-- 
Oh!  I've said too much.  Smithers, use the amnesia ray.


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

Date: Thu, 25 Oct 2001 14:48:37 -0500
From: trammell@haqq.hypersloth.invalid (John J. Trammell)
Subject: Re: At compile time Perl thinks $ is %
Message-Id: <slrn9tgr4l.moa.trammell@haqq.el-swifto.com>

On Thu, 25 Oct 2001 15:36:08 -0400, Lou Moran <lmoran@wtsg.com> wrote:
> #! /usr/bin/perl -w
> use strict ;
> use diagnostics ;
> 
> open (KEY, '<c:\dir\key.txt') or die "Can't open file $!" ; 

You can use forward-slashes for paths within Perl.  Doing so
will help you avoid unwanted escapes in the future.

> #open a file for reading
> open (FILE1, '<c:\dir\file1.txt') or die "Can't open file: $!" ; 
> #open a file for reading
> open (MATCH, '>>c:\dir\match.txt') or die "Can't open file: $!" ;
> #create/open file
> open (EXCEPT, '>>c:\dir\exception.txt') or die "Can't open file: $!" ;
> #create/open file
> 
>      my %key = <KEY> ; 

  Where does KEY come from?

>      my @file1 = <FILE1> ;
>      my $match = <MATCH> ;
>      my $exception = <EXCEPT> ;

  MATCH and EXCEPT are appending, not reading.

>      
>      foreach (keys %key) {
>           push (@file1, $_) if exists $match{$_} ; 

  $match{$_} => Here's your %match.

>                     print $match ;
> 		    #this is here to see if anything happened
> 	  }
>      foreach (keys %key) {
>           push (@file1, $_) unless exists $exception{$_} ;

  Ditto %exception.

>                     print $exception ; 
>                     #this is here to see if anything happened
>           }
> 
> 
>      
> close KEY or die "Can't close file: $!" ;
> close FILE1 or die "Can't close file: $!" ;
> close MATCH or die "Can't close file: $!" ;
> close EXCEPT or die "Can't close file: $!" ;
> 
> 
> --
> 
> This code produces the errors:
> 
> Uncaught exception from user code:
> Global symbol "%match" requires explicit package name at comp.pl line
> 16.
> Global symbol "%exception" requires explicit package name at comp.pl
> line 20.
> Execution of comp.pl aborted due to compilation errors.
> 
> I imagine that the above code won't even do the comparing I'm trying
> to get it to do but these errors don't make sense to me.  
> 
> Why does Perl think that $match and $exception are hashes?
> 
-- 
Salad: it's what's for dinner, for what's for dinner.


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

Date: Thu, 25 Oct 2001 16:00:50 -0400
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: At compile time Perl thinks $ is %
Message-Id: <8nrgttsjovje4bvapa9628v0nlavgundi3@4ax.com>

On Thu, 25 Oct 2001 14:48:37 -0500, trammell@haqq.hypersloth.invalid
(John J. Trammell) wrote wonderful things about sparkplugs:


Thanks for the explanation.  Been looking at this all wrong and too
long (dang! Sudafed)

> open (KEY, '<c:\dir\key.txt') or die "Can't open file $!" ; 
 ...
>>      my %key = <KEY> ; 
>
>  Where does KEY come from?

It's the first thing I opened.

Thanks again.

--
TMTOWTDI: My way tends to be wrong...
lmoran@wtsg.com


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

Date: 25 Oct 2001 11:49:02 -0700
From: lxz33214@yahoo.com (liping zhang)
Subject: create tarball of perl
Message-Id: <33cc1d9a.0110251049.22a36b3e@posting.google.com>

I need to create a tarball containing a version of perl that can be
used to install perl in usr/local. But I have to build and install in
a different dir other than usr/local, and create tar ball from there.
Could anyone give me a clue? Thanks.


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

Date: Thu, 25 Oct 2001 20:36:35 +0200
From: "MAGiC MANiAC^mTo" <mto@kabelfoon.nl>
Subject: current dir location?
Message-Id: <9r9mbn$286b$1@news.kabelfoon.nl>

current location...

How can I find the current dir location?...





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

Date: Thu, 25 Oct 2001 13:32:13 -0500
From: Scott Yanoff <yanoff@yahoo.com>
Subject: Re: Debugging Perl for Unix Cobalt
Message-Id: <3BD85AAD.C2FCF13B@yahoo.com>

"Mr. Ed" wrote:
> 
> I'm not much in the know of server admin for Unix Cobalt, the server I'm
> testing things on: how do I enable debugging for my Perl cgi scripts so that
> I get an error message that tells me what line # on my script is faulty
> instead of the dreaded Internal Server Error message?

I have heard that the Carp module is good for this.
Also, you should consider attempting to run the Perl script on the
command line first to see what errors come up.  You can even run it this
way:

perl -wc somescript.pl

The -w turns warnings on and the -c tells it to check the code but not
really run it.  This is a useful way for finding bugs before hooking it
up to the web.

Good luck,
-- 
-Scott
yanoff@yahoo.com | http://www.yanoff.org | AOL IM: SAY KJY


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

Date: Thu, 25 Oct 2001 19:00:42 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Difference between " and '
Message-Id: <slrn9tgku6.20e.tadmc@tadmc26.august.net>

Lou Moran <lmoran@wtsg.com> wrote:

>I just
>don't understand what the difference is between " " and ' '.

[snip]

>Where should I be looking?


In the "Quote and Quote-like Operators" section in perlop.pod.


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


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

Date: Thu, 25 Oct 2001 21:44:17 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Difference between " and '
Message-Id: <8a1httcv63u6hrml1a432l78kaenrdt372@4ax.com>

Lou Moran wrote:

>I looked up quote in perldoc and read the FAQs that came up but I just
>don't understand what the difference is between " " and ' '.
>
>print "Test\n" ;
>print 'Test\n' ;
>
>I see that these print out:
>
>Test
>Test\n
>
>but I don't know why.
>
>Where should I be looking?

Double quotes suport interpolation. That means that variables used in
such strings get replaced by their value. In addition, symbolic readable
character escape sequences do work: for example "\n", "\t", "\077",
"\x40", or plain and simple "\?" are interpreted in a special way.

By contrast, between single quotes, things are as they are in most other
languages: no interpolation, and the backslash has no special meaning
except to escape a single quote, the end delimiter with q{} (if not a
single quote), and the backslash.

	print '\\\'\}';	# ->  \'\}
	print q{\\\'\}};	# ->  \'}

The docs can be found in perlop (search for "q" and/or "qq"), though it
doesn't give much more details than I did here.

-- 
	Bart.


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

Date: Thu, 25 Oct 2001 18:47:52 +0000 (UTC)
From: "Luis Soto" <loudawg98@hotmail.com>
Subject: Re: executing a perl script
Message-Id: <0d18d2769324463adab304da031901ae.29743@mygate.mailgate.org>

THanks, i ran it as 'perl conf.pl'



-- 
Posted from  [208.247.87.66] 
via Mailgate.ORG Server - http://www.Mailgate.ORG


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

Date: Thu, 25 Oct 2001 14:16:14 -0400
From: ek <e_kelleher@hotmail.com>
Subject: Re: getting %errorlevel% values with perl?
Message-Id: <3BD856ED.F8A28664@hotmail.com>

I have tried getting values for $?, $EXTENDED_OS_ERROR, $!, and $EVAL_ERROR
all without any success at all with system() and ` `  None of them will
return the %errorlevel% of 1 I get from the command prompt or from batch
files.  Any ideas?
Thanks
Eoghan

David Wall wrote:

> ek <e_kelleher@hotmail.com> wrote on 25 Oct 2001:
>
> > I have tried catching %errorlevel% values from the command prompt
> > unsuccessfully using perl.  It seems to be a scope problem as batch
> > files seem to handle it okay.  If for example I type dir rubbish and
> > then echo %errorlevel% the return value is 1.  If I put this in a perl
> > script as
> > `dir rubbish`;
> > $var=`echo \%errorlevel\%';
> > $var's value is always 0.  Does anyone have any idea how to keep the
> > scope so perl will catch the actual %errorlevel% value?
>
> Look in the Perl docs (perlvar) for $? or use system().
>
> --
> David Wall
> darkon@one.net



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

Date: Thu, 25 Oct 2001 20:22:47 -0000
From: David Wall <darkon@one.net>
Subject: Re: getting %errorlevel% values with perl?
Message-Id: <Xns9145A6882FFDEdarkononenet@207.126.101.97>

ek <e_kelleher@hotmail.com> wrote on 25 Oct 2001:

> I have tried getting values for $?, $EXTENDED_OS_ERROR, $!, and
> $EVAL_ERROR all without any success at all with system() and ` `  None
> of them will return the %errorlevel% of 1 I get from the command
> prompt or from batch files.  Any ideas?

So what DO you get?  256?

my $returned_text = `dir rubbish`;
print $? / 256;

on my system (WinNT4) prints out 2.  (rubbish as a file or dir name 
doesn't exist on my computer.)

c:\> dir rubbish
c:\> echo %errorlevel% 

also prints 2.

-- 
David Wall
darkon@one.net


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

Date: Thu, 25 Oct 2001 20:20:01 GMT
From: "Zachary Kent" <zkent@adelphia.net>
Subject: handling numbers with leading zeros
Message-Id: <Rt_B7.9751$EO1.892778@news1.news.adelphia.net>

Our website collects Social Security Numbers and I have had problems with
Perl assuming that leading zeros are not needed and throws them out.  How do
I tell Purl to treat a variable as a string when it contains only numbers?

TIA
Zach




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

Date: Thu, 25 Oct 2001 22:43:08 +0200
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: handling numbers with leading zeros
Message-Id: <Xns9145E71EC336CLaocooneudoramailcom@62.153.159.134>

> Our website collects Social Security Numbers and I have had problems
> with Perl assuming that leading zeros are not needed and throws them
> out.  How do I tell Purl to treat a variable as a string when it
> contains only numbers? 

quotes?
my $number = "00052434";

Lao


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

Date: 25 Oct 2001 14:43:00 -0400
From: aperrin@email.unc.edu (Andrew J. Perrin)
Subject: Re: implicit split to @_
Message-Id: <87itd3tvbf.fsf@hm269-26876.socsci.unc.edu>

Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de> writes:

> 
> Better use the tr/// operator for that:
> 
> $length = ($string =~ tr / //) + 1;

Thanks - any explanation as to why?

ap

-- 
----------------------------------------------------------------------
Andrew J Perrin - andrew_perrin@unc.edu - http://www.unc.edu/~aperrin
 Assistant Professor of Sociology, U of North Carolina, Chapel Hill
      269 Hamilton Hall, CB#3210, Chapel Hill, NC 27599-3210 USA


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

Date: Thu, 25 Oct 2001 20:54:28 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: implicit split to @_
Message-Id: <3BD85FE4.6040607@post.rwth-aachen.de>

Andrew J. Perrin wrote:

> Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de> writes:
> 
> 
>>Better use the tr/// operator for that:
>>
>>$length = ($string =~ tr / //) + 1;
>>
> 
> Thanks - any explanation as to why?


tr/search_list/replace_list/ replaces each character in the search_list 
by its equivalent in replacement_list. It returns the number of 
transliterations that have thus been done. In this case, each whitespace 
is replaced with, ummh...well, the replacement_list is empty so no 
replacement actually takes place but the number of found whitespaces is 
still returned.

Mark that search_list is not a regular expression. Even though tr/// 
looks like m/// and s/// it has nothing to do with regexes, it is just 
working on single characters. See the section on tr/// in 'perldoc 
perlop' for some further details.


Tassilo


-- 
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};



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

Date: Thu, 25 Oct 2001 19:00:43 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: implicit split to @_
Message-Id: <slrn9tglf8.20e.tadmc@tadmc26.august.net>

Andrew J. Perrin <aperrin@email.unc.edu> wrote:
>
>I need to count the number of words, separated by /\s+/, in a
>string. I assumed (apparently correctly) that
>
>my $length = scalar split(/\s+/,$string);
>
>would do the trick, but in the process I get:
>Use of implicit split to @_ is deprecated at html2pg.pl line 183.
>
>perldiag suggests that it's "better" to split to an explicit array or
>list and then count that; but this string has the potential to be
>rather large, and it seems a poor use of memory to store the entire
>array of words in order to count them. 


So the entire thing goes into memory one way or another, either
into @_ or into an array of your own choosing.


>Is there another avenue I
>should be taking?


Count how many non-space chunks there are:

   my $length = () = $string =~ /(\S+)/g;


The () is to get the pattern match into list context.


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


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

Date: Thu, 25 Oct 2001 19:00:43 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: implicit split to @_
Message-Id: <slrn9tglmg.20e.tadmc@tadmc26.august.net>

Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de> wrote:

>> my $length = scalar split(/\s+/,$string);

>Better use the tr/// operator for that:
>
>$length = ($string =~ tr / //) + 1;
>
>This counts the number of whitespaces and adds 1 to that, hence should 
>result in the number of words.


But that is not at all the same thing.

tr doesn't count multiple spaces as a single separator as the split() does.

It also matches only 1 of the 5 characters that the split() matches.

If you first squeeze the separators:

   $string =~ tr/ \n\r\f\t/ /s;

_then_ your replacement will work the same as the original split().


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


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

Date: Thu, 25 Oct 2001 20:33:22 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: lookingglass.pl
Message-Id: <3bd87711.2e7f$14c@news.op.net>

In article <slrn9tfd49.3r3.mgjv@verbruggen.comdyn.com.au>,
Martien Verbruggen  <mgjv@tradingpost.com.au> wrote:
>I don't see any reason to view every occurrence of $#array as a reason
>to stop and see whether there is an opportunity to write clearer code.

OK, here's a reason: It appears that at least about 19% of uses of
$#array are inappropriate.

$#array is not a 'red flag' in the sense of being 'almost always easy
to improve', but I believe most Perl programmers would benefit if they
were to stop and consider each use of $#array.  Usually the
consideration is very brief, and the payoff only has to be five times
the investment to be a net win.

To get this result, I reviewed every appearance of $#array in a sample
of about 9,000 clp.misc articles that were posted between June 26 and
Oct 7 of this year.  173 of these articles contained a '$#', a total
of about 192 '$#'s in all.  I looked at each of these.

Details are available at 

        http://perl.plover.com/yak/flags/dollar-pound/

-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: 25 Oct 2001 13:33:35 -0700
From: fridden@yahoo.com (Fredrik)
Subject: Re: modification times on Windows files
Message-Id: <9ef98ad9.0110251233.26659817@posting.google.com>

Richard Trahan <rtrahan@monmouth.com> wrote 
> I'm running ActivePerl 5.6.1. How can I change the modification
> time on files? 

Checkout the utime function (perldoc -f utime).
There is a simple example of how to make a "touch" in perl.
I used it in w2k and perl 5.6.1

Regards
Fredrik.


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

Date: Thu, 25 Oct 2001 20:56:09 GMT
From: "Robt. Miller" <robtmil@ptd.net>
Subject: New user question
Message-Id: <Pine.LNX.4.21.0110251652250.24152-100000@localhost>

 I'm in the middle of converting my OS/2 system to Linux and the only
thing I haven't figured out how to do is recreate a program I wrote in
REXX and I'm not sure if Perl is the way to go since I know nothing about
it. All I want to do is play random .wav files from a directory at random
times. Will Perl do this?



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

Date: 25 Oct 2001 16:50:39 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: one-liner solution sought
Message-Id: <9ra1ff$m8o$1@charity.cs.utexas.edu>

In article <x7itd52e2q.fsf@home.sysarch.com>,
Uri Guttman  <uri@sysarch.com> wrote:
>perldoc -q pad

That doesn't seem to work:

    $ perldoc -q pad
    No documentation for perl FAQ keyword `pad' found

Yet, perldoc on the systems I'm on right now does seem to have the FAQ
accessible through perldoc:

    $ perldoc -q shuffle | wc -l
	  35

  - Logan
-- 
"In order to be prepared to hope in what does not deceive,
 we must first lose hope in everything that deceives."

                                          Georges Bernanos


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

Date: Thu, 25 Oct 2001 22:01:55 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Ordering pairs of links [a bit long]
Message-Id: <592httk0bomq2bqu836kt2949m9f7avhrj@4ax.com>

Jeff Zucker wrote:

>I have lists of pairs of linked items like this (link represented by a
>colon)
>
>  qw( a:b  c:d  a:d  e:f );
>
>The list can theoretically contain any number of pairs but isn't likely
>to have more than a half dozen.  There is no restriction on what items
>are linked to other items, including items linked to themselves.
>
>I want to return undef if there are any pairs in which neither item is
>linked to items outside that pair (e:f in this example). 

I don't understand that part...

>And I want to
>end up with an ordered list such that every item (except the first) has
>a link to at least one of the items on its left.  Which in this case
>would be:  abdc (the d comes before the c because it is linked to one of
>a b while c is not).

Aha. I think you should look into the Graph module on CPAN. No, I'm not
talking about a module to make pie or bar charts; but the theory behind
what you want to do, is called graph theory, that's why.

	<http://search.cpan.org/search?dist=Graph>

See also this archived newsgroup post:


<http://groups.google.com/groups?selm=slrn9mbhmm.d4m.abigail%40alexandra.xs4all.nl>

-- 
	Bart.


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

Date: Thu, 25 Oct 2001 13:52:59 -0700
From: "Eric Tetz" <my full name @ yahoo  .  com>
Subject: Perl + Cygwin + CRLF issues
Message-Id: <1004043003.420088@sj-nntpcache-5>

Greetings!  Can someone help me understand an issue I'm having with the
following script?

    # slurp file into memory
    open(IN, "<myfile") or die;
    @contents = <IN>;

    # write it back out to the same file
    open(OUT, ">myfile") or die;
    foreach $line (@contents) {
        print OUT $line;
    }

The updated file has an extra CR (ASCII 13) on the end of each line.  For
instance, if I run this script twice on a file, I end up with lines that look
like this:

    these are \r\r\r\n
    screwed up lines\r\r\r\n
    of my text file\r\r\r\n

(where I'm using \r to represent the single character ASCII 13, and \n for ASCII
10)

This is with Perl v5.6.1 build for Cygwin (i.e. Windows)

I have about 30 minutes experience with Perl, all of which is with the above
program.  I'm trying to write a little utility to update a makefile.  Any
help/suggestions appreciated.

Cheers,
Eric







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

Date: Thu, 25 Oct 2001 15:00:44 -0600
From: Ron Reidy <rereidy@indra.com>
Subject: Re: Perl + Cygwin + CRLF issues
Message-Id: <3BD87D7C.80657B77@indra.com>

Eric Tetz wrote:
> 
> Greetings!  Can someone help me understand an issue I'm having with the
> following script?
> 
>     # slurp file into memory
>     open(IN, "<myfile") or die;
>     @contents = <IN>;
> 
>     # write it back out to the same file
>     open(OUT, ">myfile") or die;
>     foreach $line (@contents) {
>         print OUT $line;
>     }
> 
> The updated file has an extra CR (ASCII 13) on the end of each line.  For
> instance, if I run this script twice on a file, I end up with lines that look
> like this:
> 
>     these are \r\r\r\n
>     screwed up lines\r\r\r\n
>     of my text file\r\r\r\n
> 
> (where I'm using \r to represent the single character ASCII 13, and \n for ASCII
> 10)
> 
> This is with Perl v5.6.1 build for Cygwin (i.e. Windows)
> 
> I have about 30 minutes experience with Perl, all of which is with the above
> program.  I'm trying to write a little utility to update a makefile.  Any
> help/suggestions appreciated.
> 
> Cheers,
> Eric
I would guess these charters are in your source file also.  It looks
like the way Win32 and DOS implement new lines.
-- 
Ron Reidy
Oracle DBA
Reidy Consulting, L.L.C.


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

Date: Thu, 25 Oct 2001 14:12:51 -0700
From: "Eric Tetz" <my full name @ yahoo  .  com>
Subject: Re: Perl + Cygwin + CRLF issues
Message-Id: <1004044591.745628@sj-nntpcache-3>

"Ron Reidy" <rereidy@indra.com> wrote in message
news:3BD87D7C.80657B77@indra.com...
> Eric Tetz wrote:
> > The updated file has an extra CR (ASCII 13) on the end of each line.
> >
> I would guess these charters are in your source file also.  It looks
> like the way Win32 and DOS implement new lines.

Yes, DOS and Window implement newlines as CRLF.  However, a *new* CR is being
added to each line each time I run the script.  For instance, the file starts
out as

    line one\r\n
    line two\r\n

Run the script once to get:

    line one\r\r\n
    line two\r\r\n

Run the script again to get:

    line one\r\r\r\n
    line two\r\r\r\n

And so on. The point is, the script, as far as I can tell, should be writing out
exactly what it reads in. Where are these extra characters coming from?

Cheers,
Eric




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

Date: Thu, 25 Oct 2001 12:01:32 -0700
From: "Jordan Reed" <anomie@my-deja.com>
Subject: Re: Perl Vs. Java
Message-Id: <3bd86100@monitor.lanset.com>

One of the things I've always found interesting is that it's quite provable
that languages compiled to intermediary code are able to run the fastest.
We just don't have enough compile and runtime optimization research yet to
write good enough virtual machines to make this a reality.  Still, it's one
of the big reasons that MS's .NET framework compiles to MSIL instead of
machine code (even though you're basically guaranteed to be running on a
Wintel box).

It'll be interesting to see how Perl.NET runs in terms of performance.  One
would expect that on Windows machines it will run noticeably faster than
ActiveState's stuff.

Jordan/2


"Logan Shaw" <logan@cs.utexas.edu> wrote in message
news:9r7rc5$gi8$1@charity.cs.utexas.edu...
[snip...]
>
> Now, I know that the Sieve of Eratostenes is not the ultimate in
> accurate benchmarks.  I may ultimately be testing my computer's memory
> latency by trying to find the primes that lie in an interval of two
> million integers.  And I know that not all code is made up of tight
> loops doing simple integer arithmetic.
>
> But the point is that, at least in certain circumstances, Java's
> performance can really be quite good.
>
>   - Logan
> --
> "In order to be prepared to hope in what does not deceive,
>  we must first lose hope in everything that deceives."
>
>                                           Georges Bernanos




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

Date: Thu, 25 Oct 2001 18:25:07 GMT
From: "William Seeley" <william-seeley@home.com>
Subject: Re: Perl, MySQL, MS Access, Windows AND Linux
Message-Id: <7OYB7.36973$%B6.13724682@typhoon.southeast.rr.com>

You could also get rid of Access entirely and run MySQL in your Windows
environment as well.


"Rubber Ducky" <none@none.com> wrote in message
news:1NHB7.8711$P4.834023@news1.cableinet.net...
> Is it possible to interact with both MySQL AND MS Access at the same time
> with Perl?  I want it to run on both on windows and on linux. Could you
> please provide SOME details of how I can acomplish such a thing!  Souce
code
> would be ideal!  I appreicate this.
>
> --
> Thanks lots RD
>
>
>




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

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.  

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


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