[6534] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 159 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Mar 22 10:07:18 1997

Date: Sat, 22 Mar 97 07:00:28 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 22 Mar 1997     Volume: 8 Number: 159

Today's topics:
     Re: An interesting socket puzzle <rra@cs.stanford.edu>
     Re: Another dereferencing bug in 5.003 ? <merlyn@stonehenge.com>
     Re: Checking a '/' chr. is not present <lerdsuwa@scf.usc.edu>
     Re: cls || ClrScr?? (Simon Hyde)
     Re: Converting Perl to c++ (Simon Hyde)
     Cutting space <b39jrj@nontri.ku.ac.th>
     Re: Cutting space (Clay Irving)
     Forward- and Backslashes as Pathname Delimiters rtanikella@rfbd.org
     Re: Getting data in random order. <dbenhur@egames.com>
     Re: Help needed with PERL script! (Simon Hyde)
     How do I delete a line out of a text file <menger@mindless.com>
     Re: How do I delete a line out of a text file (Honza Pazdziora)
     Re: How do I delete a line out of a text file (Simon Hyde)
     Re: how do i... (Clay Irving)
     Re: How to get file time and date stamps? <rmcvay@acm.org>
     Re: How to get file time and date stamps? <rra@cs.stanford.edu>
     Re: Installation Question <grantr@epsc-s2.saicspt.com>
     Re: Lost backslash <rra@cs.stanford.edu>
     Re: Perl for win95 (Clay Irving)
     Re: Perl for win95 (Simon Hyde)
     Perl Newbie: ls -R in NT jsmorgan@ccgate.hac.com
     Problem Building POSIX module of Perl 5.003 for Solaris (Danton Chin)
     Q: how to create,save,load,sort by key#1, key#2, etc, a (Apple-O)
     Re: Reg: tr command (Simon Hyde)
     Re: regex for UNIX usernames needed! <shimpei@socrates.caltech.edu>
     Re: regex for UNIX usernames needed! <merlyn@stonehenge.com>
     Re: regex in perl4 <mohan@sapna.india.hp.com>
     Re: strange error using anonymous arrays under Solaris  <rra@cs.stanford.edu>
     Re: term 'regular expressions' considered undesirable <vladimir@cs.ualberta.ca>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 22 Mar 1997 03:25:19 -0800
From: Russ Allbery <rra@cs.stanford.edu>
To: Chuck Bermingham <bermingh@concentric.net>
Subject: Re: An interesting socket puzzle
Message-Id: <qumafnwdv8g.fsf@cyclone.stanford.edu>

[ Posted and mailed. ]

Chuck Bermingham <bermingh@concentric.net> writes:

> What it does is to create a bi-directional socket dialog between your
> console and whatever port you connect to.  For instance, "client2
> news.concentric.net nntp" will start up a "chat" with the news server,
> and you can fool with the commands and stuff.  A little like telnet.  I
> picked up this forking trick for telecomm from an old comm program I
> once saw on Coherrent, for serial ports.

Yup.  The fork and using one process as the reader and the other is a
writer is a cute trick.  It's part of a larger suite of similar tricks
that all involve forking off a process to do something that may block
rather than trying to find a nonblocking workaround.

> But if you substitute:

>   print SOCK1 $line;

> for the last executable statement (the "send", it hangs.

You didn't unbuffer your socket.  Add:

	my $oldfh = select (SOCK1); $| = 1; select ($oldfh);

to your script after the connect() and it should start working.

-- 
Russ Allbery (rra@cs.stanford.edu)      <URL:http://www.eyrie.org/~eagle/>


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

Date: 22 Mar 1997 07:51:11 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Jim Garrison <jhg@austx.tandem.com>, perlbug@perl.com
Subject: Re: Another dereferencing bug in 5.003 ?
Message-Id: <8cu3m4ugio.fsf@gadget.cscaper.com>

>>>>> "Jim" == Jim Garrison <jhg@austx.tandem.com> writes:

Jim>       DB<23> p @$x->[0]
Jim>     ARRAY(0x26a850)

Jim>       DB<24> p @{$x->[0]}
Jim>     123

Jim> I would have thought that these two expressions were
Jim> equivalent.  If this isn't a bug, can someone please
Jim> explain exactly what the result of the first (DB<23>)
Jim> expression is?  It looks syntactically like an array,
Jim> but the debugger seems to think it's a scalar reference
Jim> to an array.  Note also the address returned in lines
Jim> <21> and <23>.  This seems to indicate that the debugger
Jim> thinks $x->[0] and @$x->[0] are the same thing, which
Jim> is clearly not the case.

The problem is that @$foo->[...] is *illegal* syntax that wasn't
caught correctly by 5.003, and there was some discussion about how
difficult it would be to detect it, so it apparently didn't get fixed
for 5.004 (as I just tested in one of the betas).

Maybe it's something for 5.005 to fix.

In the meanwhile, if it hurts, don't do it.  It's illegal.  Just like
%$foo->{blah}.  Also illegal, but currently doesn't set off the proper
alarms.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 528 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Fri, 21 Mar 1997 23:50:22 -0800
From: Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
Subject: Re: Checking a '/' chr. is not present
Message-Id: <33338F3E.3C58@scf.usc.edu>

Paul Denman wrote:
: 
: Hello,
: 
: I have written a username/password script, and need to check that
: the following characters are not in either;   ":", "/" and " " 
: space).
: 
: I am using the syntax:
: 
: if (($FORM{username} !~ /:/) && ($FORM{username} !~ / /)) {
:         ...
: }
: 
: I can't work out how to check for the '/' character. (!~ /// doesn't
: work).
: Can anyone help me on this?
: 
: Thanks,
: 
: Paul Denman
: pdenman@ims.ltd.uk

Try !~ /\// .  The '/' to be checked must be escaped by the prefix '\'
to distinguish it from the enclosing /.../ .

Kriang

--
Signature not found
Abort, Retry, Fail?


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

Date: Sat, 22 Mar 1997 12:58:03 GMT
From: shyde@poboxes.com (Simon Hyde)
Subject: Re: cls || ClrScr??
Message-Id: <3333d716.8842512@iiscgate.iisc.co.uk>

On Fri, 21 Mar 1997 17:36:26 -0500, Peter Tapolyai <peter@uhu.com>
wrote:

>How do you clear the screen in perl ?

well...you could try system("clear") or print "\n"x100;
but really there is no proper way to do it.
---
Yours Sincerely,
                                      ,                     
   () o                              /|   |          |      
   /\     _  _  _    __   _  _        |___|        __|   _  
  /  \|  / |/ |/ |  /  \_/ |/ |       |   |\|   | /  |  |/  
 /(__/|_/  |  |  |_/\__/   |  |_/     |   |/ \_/|/\_/|_/|__/
                                               /|           
                                               \|           
(Simon Hyde)
/****************How To Contact Me******************\
|         Internet Email: shyde@POBoxes.com         |
\***************************************************/


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

Date: Sat, 22 Mar 1997 12:27:48 GMT
From: shyde@poboxes.com (Simon Hyde)
Subject: Re: Converting Perl to c++
Message-Id: <3339c246.3513688@news.uni-stuttgart.de>

On Thu, 20 Mar 1997 18:02:11 -0700, andy@wwdatalink.com wrote:

>Does anyone know of a program that can convert a perl program into c++.
>
>Andrew Koons
>andy@wwdatalink.com

I'm not sure about whether it converts to C or C++ but if you take a
look at the perl compiler (off the software link from
www.perl.com/perl) that should probably do what you want.
---
Yours Sincerely,
                                      ,                     
   () o                              /|   |          |      
   /\     _  _  _    __   _  _        |___|        __|   _  
  /  \|  / |/ |/ |  /  \_/ |/ |       |   |\|   | /  |  |/  
 /(__/|_/  |  |  |_/\__/   |  |_/     |   |/ \_/|/\_/|_/|__/
                                               /|           
                                               \|           
(Simon Hyde)
/****************How To Contact Me******************\
|         Internet Email: shyde@POBoxes.com         |
\***************************************************/


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

Date: Sat, 22 Mar 1997 12:46:44 +0700
From: Joruno Jobana <b39jrj@nontri.ku.ac.th>
Subject: Cutting space
Message-Id: <33337244.E0F@nontri.ku.ac.th>

Dear,
	I have one string with data.
>> $ST="abc    def  ghi     jkl";
	I want to separate this string to be sub string with space and 
put it in array like this.
>> $A[0] = "abc"   $A[1] = "def"   $A[2] = "ghi"   $A[3] = "jkl"
	Someone tell me to use general expression. But I don't 
know how to use it? Could you help me, please?
Sincerely,
Joruno


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

Date: 22 Mar 1997 06:47:40 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Cutting space
Message-Id: <5h0gss$eca@panix.com>

In <33337244.E0F@nontri.ku.ac.th> Joruno Jobana <b39jrj@nontri.ku.ac.th> writes:

>Dear,
>	I have one string with data.
>>> $ST="abc    def  ghi     jkl";
>	I want to separate this string to be sub string with space and 
>put it in array like this.
>>> $A[0] = "abc"   $A[1] = "def"   $A[2] = "ghi"   $A[3] = "jkl"
>	Someone tell me to use general expression. But I don't 
>know how to use it? Could you help me, please?

#!/usr/local/bin/perl5.003

$ST="abc    def  ghi     jkl";    # Your string

@A = split /\s+/, $ST;            # Split on one or more spaces
                                  # and put the results in an array
$i = 0;

for ($i .. $#A) {
  print "\$A[$i] = $A[$i]\n";     # Print the elements of the array
  $i++;
}

Result:

$A[0] = abc
$A[1] = def
$A[2] = ghi
$A[3] = jkl

[ mailed and posted ]

-- 
Clay Irving                                        See the happy moron,
clay@panix.com                                     He doesn't give a damn,
http://www.panix.com/~clay                         I wish I were a moron,
                                                   My God! Perhaps I am!


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

Date: Fri, 21 Mar 1997 16:01:27 -0600
From: rtanikella@rfbd.org
Subject: Forward- and Backslashes as Pathname Delimiters
Message-Id: <858980372.12115@dejanews.com>

Hello,

Perhaps this picks up on a thread that seems to have ended a while ago,
but here it is: In Perl for OS/2, are the forward-slash and backslash
both recognized as pathname delimiters? I encounter errors using system
to call programs with arguments which are set off by forward slashes. So,
for example:

$pid = system(P_WAIT, 'SGMLBLD.EXE');

will correctly attempt to spawn the process (which fails because there
are no arguments); meanwhile,

$pid = system(P_WAIT, 'SGMLBLD.EXE /INPUT:C:\BUILD\EB424\SGML-IN.BIF');
fails with an error stating: Can't spawn "SGMLBLD.EXE
/INPUT:C:\BUILD\EB424\SGML-IN.BIF": No such file or directory at
n:systest.p line 58. system call returned the following:--->255<---

Am I correct in assuming this result is because the forward-slash
preceding the INPUT parameter is being taken by the perl interpreter as a
pathname? Or is there something else that I'm doing incorrectly?

Thanks in advance...
Reg
------------------------------------------------
Rajanikanth Tanikella                  Internet: rtanikella@rfbd.org
E-Text Programmer                      WWW: http://www.rfbd.org
Recording For the Blind and Dyslexic   Phone: 609/520.8006
20 Roszel Rd                           Fax:609/520.7990
Princeton NJ 08540                     </sig>

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Fri, 21 Mar 1997 13:18:41 -0800
From: Devin Ben-Hur <dbenhur@egames.com>
To: tshell@mcs.net
Subject: Re: Getting data in random order.
Message-Id: <3332FB31.265C@egames.com>

Timothy Shell wrote:
> I want to output a list of records in a random sequence each time the
> program runs.  So if I have a data file with 100 records, I'd like to
> pick, say, 20 records at random and display them in no particular order.

This does pretty much what you want:

srand( time() ^ ($$ + ($$<<15)) );
open(FILE,"datafilename") or die("Can't open file: $!");
my @list = <FILE>;
close FILE;
my $pick = 20;
while ($pick--) {
    print splice(@list, int(rand(@list)), 1);
}

rand(@list) picks a number from 0 to the size of the list.
splice() deletes that entry from the list and returns the 
deleted entry.

If your datafile isn't simple text lines, adjust the
file reading piece accordingly.

see man perlfunc

HTH
--
Devin Ben-Hur      <dbenhur@egames.com>
eGames.com, Inc.   http://www.egames.com/
eMarketing, Inc.   http://www.emarket.com/
*** The InterNIC screwed up our billing so "egames.com" won't
*** work until Monday.  Use "easystreet.com" instead.




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

Date: Sat, 22 Mar 1997 12:27:50 GMT
From: shyde@poboxes.com (Simon Hyde)
Subject: Re: Help needed with PERL script!
Message-Id: <333bcb49.5820783@news.uni-stuttgart.de>

On Fri, 21 Mar 1997 20:47:21 GMT, njohnson@enterprise.net (Neil
Johnson) wrote:

>Hi,
>
>It's thanks to previous help in this newsgroup that I have got this
>far on my Perl script so please don't fail me now!!
>
>My script (Which is at the bottom of this message) displays an HTML
>page indexing the server's directories and files. But I have a few
>questions and queries.
>
>Firstly I the path that the script starts to index from is stored in
>the $dir but I want to allow people to addan argument at the end of
>the script when executing e.g. index.pl?d:\\wwwroot\ftp\ 
>
>I know you can change $dir to this: $dir=ARGV[0]
>
>But is there a piece of script that can check if a path is given and
>if not reverts back to the default of $dir=".." ??
>
>Secondly, and this is the bit I have gone desperate on, is there
>anyway I can get the file dates & times so I can display them too. The
>script already displays file name, directory, file size and file age
>(in days) but is there anyway I can get the other file details such as
>date & time of each file??
>
>The last problem is how to format the $TotalSizeMb string into
>999,999,999 instead of 999999999. I have found a piece of code that
>does this but I have no idea of where to put it!
>
>The peice of code is:
>
>1 while s/(\d)(\d\d\d)(?!\d)/$1,$2/g; 
>
>Hope you all can help!! By the way the script is to be used on
>Microsoft IIS. The script is below:
>
well...i've found a few things which may send this script a bit
mental, and corrected them, and also added the passing from query
string option and a last modification date column and number formating

#!/usr/bin/perl -w 

$dir = ".." || $ENV{'QUERY_STRING'};

# Create HTML file & content header

print "Content-type: text/html\n\n"; # don't want < marks > around

                                                      #header
print "
<HTML>
<HEAD><TITLE>File Index</TITLE></HEAD>
<BODY BGCOLOR=#FFFFFF>
<FONT FACE=Arial>
<P>
<H2>Indexer</H2>
</P>
<TABLE>
<TR>
<TD><B>Directory </B></TD>
<TD><B>File Name</B></TD>
<TD><B>Size(Bytes) </B></TD>
<TD><B> Age(days)</B></TD>
<TD><B> Last Modification Date</B></TD>
</TR>
<TD><HR></TD><TD><HR></TD><TD><HR></TD><TD><HR></TD>
";

$TotalSize = 0;
$DirSize = 0;
&traverse($dir);                           

sub traverse {
    local($DirSize) = 0;
    local($dir) = shift;
    local($path);
    unless (opendir(DIR, $dir)) {
        warn "Can't open $dir\n";   # Error message if we cannot open
directory
	closedir(DIR);
	return;
    }
    foreach (readdir(DIR)) {
	next if $_ eq '.' || $_ eq '..';
	$path = "$dir/$_";
	if (-d $path) {                      # Read Sub-Directories
	    &traverse($path);
        } elsif (-f $_) {                     # Read all files
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
       $atime,$mtime,$ctime,$blksize,$blocks)
           = stat($path);
        $modtime = localtime($mtime);
        $size = -s $path;                        # Get file size
        $age = int (-M $path);                   # Get file age
        $DirSize = $DirSize + eval(-s $path);    # Calculate directory
size 
	print "
	<TR>
	<TD>$dir</TD>
	<TD>$_</TD>
               1 while $size =~ s/(\d)(\d{3})(,|$)/$1,$2$3/g;
	<TD ALIGN=RIGHT>$size</TD>
	<TD ALIGN=RIGHT>$age</TD>
	<TD ALIGN=RIGHT>$modtime</TD>
        </TR>";
	}
    }
    1 while $DirSize =~ s/(\d)(\d{3})(,|$)/$1,$2$3/g;
    print "<TR><TD><B>$dir</B></TD><TD><B>Total Dir</B></TD><TD
ALIGN=RIGHT><B>$DirSize</B></TD></TR>";
    $TotalSize = $TotalSize + $DirSize;	
	closedir(DIR);
}

        $TotalSizeMb = ($TotalSize / 1024) / 1024;
        $TotalSizeMb = int ($TotalSizeMb);
        1 while $TotalSizeMb =~ s/(\d)(\d{3})(,|$)/$1,$2$3/g;
        print "
</TABLE>
<H2>Total in directory tree $dir = $TotalSizeMb Mb</H2><P>
<HR>
</FONT>
</BODY>
</HTML>
";



---
Yours Sincerely,
                                      ,                     
   () o                              /|   |          |      
   /\     _  _  _    __   _  _        |___|        __|   _  
  /  \|  / |/ |/ |  /  \_/ |/ |       |   |\|   | /  |  |/  
 /(__/|_/  |  |  |_/\__/   |  |_/     |   |/ \_/|/\_/|_/|__/
                                               /|           
                                               \|           
(Simon Hyde)
/****************How To Contact Me******************\
|         Internet Email: shyde@POBoxes.com         |
\***************************************************/


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

Date: 22 Mar 1997 08:42:51 GMT
From: "Matthew Enger" <menger@mindless.com>
Subject: How do I delete a line out of a text file
Message-Id: <01bc369c$ca675920$0202a8c0@pynitoa089-mje>

Hello,
	I am new to perl and I need to delete aline out of a textfile. I have a
aray called @lines which I was going to delete a part out of that then
output the aray to file. Does anyone have a methoud of doing this? Or
deleteing a line using another method?

	from,
		Matthew Enger
		menger@mindless.com


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

Date: Sat, 22 Mar 1997 12:22:56 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: How do I delete a line out of a text file
Message-Id: <adelton.859033376@aisa.fi.muni.cz>

"Matthew Enger" <menger@mindless.com> writes:

> Hello,
> 	I am new to perl and I need to delete aline out of a textfile. I have a
> aray called @lines which I was going to delete a part out of that then
> output the aray to file. Does anyone have a methoud of doing this? Or
> deleteing a line using another method?

man perlfunc

splice - add or remove elements anywhere in an array

Or write the deletion right on the input stream:

while (<>)
	{
	print unless /delete this/;
	}

Hope this helps.

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Sat, 22 Mar 1997 13:22:11 GMT
From: shyde@poboxes.com (Simon Hyde)
Subject: Re: How do I delete a line out of a text file
Message-Id: <333adc9e.10258691@news.doha.net>

On 22 Mar 1997 08:42:51 GMT, "Matthew Enger" <menger@mindless.com>
wrote:

>Hello,
>	I am new to perl and I need to delete aline out of a textfile. I have a
>aray called @lines which I was going to delete a part out of that then
>output the aray to file. Does anyone have a methoud of doing this? Or
>deleteing a line using another method?
>
splice should do it with something like:
splice(@lines, $line_num, 1);
take a look at the splice section of man perlfunc for more info.
---
Yours Sincerely,
                                      ,                     
   () o                              /|   |          |      
   /\     _  _  _    __   _  _        |___|        __|   _  
  /  \|  / |/ |/ |  /  \_/ |/ |       |   |\|   | /  |  |/  
 /(__/|_/  |  |  |_/\__/   |  |_/     |   |/ \_/|/\_/|_/|__/
                                               /|           
                                               \|           
(Simon Hyde)
/****************How To Contact Me******************\
|         Internet Email: shyde@POBoxes.com         |
\***************************************************/


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

Date: 22 Mar 1997 06:25:12 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: how do i...
Message-Id: <5h0fio$d5p@panix.com>

In <5gv31i$l3j$1@paladin.american.edu> jn0729a@cage.cas.american.edu (Jon Nathan) writes:

>this is what i would like to do:
>have an html page with a list of links.  when a user clicks one of the 
>links, it takes him to a template html page with a specific image on it.  

>this would be so that i don't have to write 50 simple html pages with an 
>image tag.  

>sounds like it should be easy, but i'm not sure where to start.  how do i 
>pass a variable to the perl script depending on which link in the html 
>page is clicked?

Pass a parameter with a URL like this:

http://www.your-url.edu?parameter

Get the parameter in a Perl program like this:

chomp($parameter = shift(@ARGV));

Hope that helps,

-- 
Clay Irving                                        See the happy moron,
clay@panix.com                                     He doesn't give a damn,
http://www.panix.com/~clay                         I wish I were a moron,
                                                   My God! Perhaps I am!


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

Date: Sat, 22 Mar 1997 00:21:51 -0600
From: Ray McVay <rmcvay@acm.org>
Subject: Re: How to get file time and date stamps?
Message-Id: <33337A7F.6035@acm.org>

Marcelo de Azevedo Camelo wrote:
> 
> I'm writing a CGI script in Perl 5, and I need it to
> read both time and date stamps from a file residing
> in current directory. Is it possible? If so, how can I
> do it?

Check out the 'stat' function.


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

Date: 22 Mar 1997 02:51:40 -0800
From: Russ Allbery <rra@cs.stanford.edu>
To: "Marcelo de Azevedo Camelo" <camelo@itanet.com.br>
Subject: Re: How to get file time and date stamps?
Message-Id: <qumend8dwsj.fsf@cyclone.stanford.edu>

[ Posted and mailed. ]

Marcelo de Azevedo Camelo <camelo@itanet.com.br> writes:

> I'm writing a CGI script in Perl 5, and I need it to read both time and
> date stamps from a file residing in current directory. Is it possible?
> If so, how can I do it?

man perlfunc.  Look at the file tests at the beginning and the section on
stat in particular.  If you don't have access to the documentation that
comes with Perl, complain bitterly to your system administrator and then
take a look on <URL:http://www.perl.com/perl/> which has it all.

-- 
Russ Allbery (rra@cs.stanford.edu)      <URL:http://www.eyrie.org/~eagle/>


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

Date: Fri, 21 Mar 1997 06:51:12 -0800
From: Russ Grant <grantr@epsc-s2.saicspt.com>
Subject: Re: Installation Question
Message-Id: <3332A060.4965@epsc-s2.saicspt.com>

I was sent the Welcome to comp.lang.perl.misc message which helped me
answer my own question. I searched the comp.lang.perl.misc archieve at
http://www.dejanews.com/ and found a fellow who had a similar problem, I
sent him mail and here is his response:
Hi,
	Yes, that problem was avoided with a small addition to the
Configure script. 

	If you look at the "Configure" script at the point where it
creates signal.awk ... you will see that the awk script has a lot of
code
in the 'END' section. One of these sets the value of nsig. One more line
here crudely fixes the problem. 

line # 8033 (approx)
END {
    if (nsig == 0) { nsig = maxsig + 1 }
        nsig = 50   /* <- this is a new line that was added.   */ 


Hope this helps. 
Sajjad 

This corrected this problem, many thanks to Sajjad. Now on to my next
problem..


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

Date: 22 Mar 1997 02:42:28 -0800
From: Russ Allbery <rra@cs.stanford.edu>
To: buehner@pfaffenhofen.netsurf.de
Subject: Re: Lost backslash
Message-Id: <qumiv2kdx7v.fsf@cyclone.stanford.edu>

[ Posted and mailed. ]

Thomas Buehner <buehner@pfaffenhofen.netsurf.de> writes:

> So, the safest thing to do when you want to escape the backslash hunt
> for good is to use q!\.\\test! ...

Nope:

cyclone:~> perl
print q!\.\\test!, "\n";
\.\test

But this works:

cyclone:~> perl
print <<'EOM';
\.\\test
EOM
\.\\test

So if you really want to escape the problem completely, it looks like you
have to use here-docs.  Perl still collapses multiple backslases in q!!
strings because you have to have a way of quoting the !.

-- 
Russ Allbery (rra@cs.stanford.edu)      <URL:http://www.eyrie.org/~eagle/>


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

Date: 22 Mar 1997 06:49:47 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Perl for win95
Message-Id: <5h0h0r$ehg@panix.com>

In <01bc3687$918db780$0a46a2cd@deano.nh.ultranet.com> "Dean Ouellette" <deano@nh.ultranet.com> writes:

>I am leaning Perl,  Is there anywhere I can download a free version of Perl
>5??

In the CPAN (Comprehensive Perl Archive Network) ports directory:

	http://www.perl.com/CPAN/ports/

-- 
Clay Irving                                        See the happy moron,
clay@panix.com                                     He doesn't give a damn,
http://www.panix.com/~clay                         I wish I were a moron,
                                                   My God! Perhaps I am!


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

Date: Sat, 22 Mar 1997 13:07:25 GMT
From: shyde@poboxes.com (Simon Hyde)
Subject: Re: Perl for win95
Message-Id: <3337d950.9411659@news.doha.net>

On 22 Mar 1997 06:09:52 GMT, "Dean Ouellette" <deano@nh.ultranet.com>
wrote:

>I am leaning Perl,  Is there anywhere I can download a free version of Perl
>5??
>

You can get the win 32 (windows 95 or windows NT) port from
http://www.activeware.com
---
Yours Sincerely,
                                      ,                     
   () o                              /|   |          |      
   /\     _  _  _    __   _  _        |___|        __|   _  
  /  \|  / |/ |/ |  /  \_/ |/ |       |   |\|   | /  |  |/  
 /(__/|_/  |  |  |_/\__/   |  |_/     |   |/ \_/|/\_/|_/|__/
                                               /|           
                                               \|           
(Simon Hyde)
/****************How To Contact Me******************\
|         Internet Email: shyde@POBoxes.com         |
\***************************************************/


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

Date: Fri, 21 Mar 1997 21:05:18 GMT
From: jsmorgan@ccgate.hac.com
Subject: Perl Newbie: ls -R in NT
Message-Id: <3332f722.22164434@hacgate2.hac.com>

As part of a script I am writing I need to the total size of all files
in a directory including all files in all subdirectories.  I am trying
to write a recursive subroutine to do this, but it isn't working.
This should be fairly simple.  If anyone has done this before, I would
appreciate any help.

Thanks,
Jim Morgan
Computer Sciences Corp.
jsmorgan@ccgate.hac.com


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

Date: Sat, 22 Mar 1997 08:36:05 GMT
From: djchin@westnet.com (Danton Chin)
Subject: Problem Building POSIX module of Perl 5.003 for Solaris 2.5
Message-Id: <5gvrb4$jd8$1@mycroft.westnet.com>

I am having a problem building the POSIX module for Perl 5.003 for
Solaris 2.5 using GNU cc version 2.7-96q3.  Configure cannot find the
lposix and the lcposix libraries and the portion of make for the POSIX
module displays warning messages since these libraries cannot be
found. Where are these libraries on a typical Solaris 2.5 system? If
they are optional where can I get them?  Or does it have something to
do with the way I answered the configuration questions? I have
included below as many details as I thought to be pertinent. 

Thanks in advance for any help anyone out there can give!

Danton Chin


1. Configure is invoked with:

	sh Configure -Dcc=gcc -Dprefix=/opt/gnu/perl

     and just about all configuration questions are answered using the
defaults except for:

Directories to use for library searches? [/lib /usr/lib /usr/ccs/lib]
/lib /usr/lib /usr/ccs/lib /opt/gnu/gdbm/lib
/opt/cygnus/H-sparc-sun-solaris2/lib

Any additional cc flags? [none] -B/usr/ccs/bin -I/opt/gnu/gdbm/include
-I/usr/include

Any additional ld flags (NOT including libraries)? [none]
-B/usr/ccs/bin -L/opt/gnu/gdbm/lib

2. Configure could not find:

No -lcposix.
No -lposix.

3. The make portion of the POSIX module:

        Making POSIX (dynamic)
Warning (will try anyway): No library found for -lposix
Warning (will try anyway): No library found for -lcposix
Writing Makefile for POSIX
cp POSIX.pod ../../lib/POSIX.pod
cp POSIX.pm ../../lib/POSIX.pm
AutoSplitting POSIX (../../lib/auto/POSIX)
 ../../miniperl -I../../lib -I../../lib ../../lib/ExtUtils/xsubpp
-noprototypes -typemap ../../lib/ExtUtils/typemap -typemap typemap
POSIX.xs >POSIX.tc && mv POSIX.tc POSIX.c
gcc -c  -B/usr/ccs/bin -I/opt/gnu/gdbm/include -O
-DVERSION=\"1.00\"  -DXS_VERSION=\"1.00\" -fpic -I../..  POSIX.c
gcc: file path prefix `/usr/ccs/bin' never used
Running Mkbootstrap for POSIX ()
chmod 644 POSIX.bs
LD_RUN_PATH="/lib" gcc -o ../../lib/auto/POSIX/POSIX.so -G
-L/opt/gnu/gdbm/lib POSIX.o    -lm 
chmod 755 ../../lib/auto/POSIX/POSIX.so
cp POSIX.bs ../../lib/auto/POSIX/POSIX.bs
chmod 644 ../../lib/auto/POSIX/POSIX.bs

4. And in the make test all modules are ok except for the POSIX module
which fails:
 ...
lib/posix......FAILED on test 12
lib/safe.......ok
lib/sdbm.......ok
lib/socket.....ok
lib/soundex....ok
Failed 1 test, 98.94% okay.
u=0.91  s=1.4  cu=25.71  cs=27.47  files=94  tests=1968





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

Date: Sat, 22 Mar 97 09:20:34 GMT
From: appleo@cybercomm.net (Apple-O)
Subject: Q: how to create,save,load,sort by key#1, key#2, etc, a list?
Message-Id: <5h0814$kci$2@news.nac.net>

in perl i want to write a script that takes a 3-column list & writes it to 
disk as an array (3 dimensional?), and can load the file and sort under key#1, 
key#2, key#3... kind of like for a guest book on a web page, so it can list by 
date, email address, topic, etc, depending on what the user wants to see. how 
can you do this? (please try to keep any scripts or sample code to simple 
elemental commands and not the complicated does 1000 things in 1 line kind of 
stuff, it's much easier for me to understand perl scripts written in the style 
of of c or pascal)



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

Date: Sat, 22 Mar 1997 13:05:15 GMT
From: shyde@poboxes.com (Simon Hyde)
Subject: Re: Reg: tr command
Message-Id: <3336d8d2.9285890@iiscgate.iisc.co.uk>

On Fri, 21 Mar 1997 14:12:16 -0500, Zacharia George
<zgeorge@eos.ncsu.edu> wrote:

>Hi,
>	Could someone please tell me how to convert from Uppercase to 
>Lowercase in a string EXCEPT for the first letter of each word in the
>string. I assume that the "tr" command (I may be wrong!) can do this but
>I am not sure how. 
>e.g.:
>to convert
>ZACHARIA GEORGE to Zacharia George
I'm not sure about tr but it can be done with $string =~
s/(\s*)(\S+)(\s+)/$1.ucfirst(lc($2)).$3/eg;
---
Yours Sincerely,
                                      ,                     
   () o                              /|   |          |      
   /\     _  _  _    __   _  _        |___|        __|   _  
  /  \|  / |/ |/ |  /  \_/ |/ |       |   |\|   | /  |  |/  
 /(__/|_/  |  |  |_/\__/   |  |_/     |   |/ \_/|/\_/|_/|__/
                                               /|           
                                               \|           
(Simon Hyde)
/****************How To Contact Me******************\
|         Internet Email: shyde@POBoxes.com         |
\***************************************************/


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

Date: 22 Mar 1997 06:20:08 GMT
From: Shimpei Yamashita <shimpei@socrates.caltech.edu>
Subject: Re: regex for UNIX usernames needed!
Message-Id: <5gvtmo$im2@gap.cco.caltech.edu>

Jarkko Hietaniemi  <jhi@alpha.hut.fi> writes:
>
>
>: Well, ignoring the typo for a moment, a valid Unix username is all
>: lowercase (uppercase confuses /etc/init's login prompt), and not all
>: numeric (which confuses chown and friends), so that'd be:
>: 
>: 	/^(?=.*?\D)[a-z\d]+$/
>: 
>: And there's really no length limit, although most utilities like it to
>: be under nine characters.  Just change the final + to {1,8} if you
>: think you want that restriction.
>
>This is mostly ok. I just feel compelled to ask 'says who?' I have
>never seen a standard saying anything about UNIX usernames, anything
>about restrictions. It is all a question of how confused would various
>UNIX utilities be "if" (read: each utility having to do with usernames
>has answered this very question in its own way which normally is
>different from any other) This wouldn't be the first time I've been
>known to have erred and of there is really such a standard please let
>me and other readers of comp.lang.perl.misc know. But even if there
>were a Standard about this, it all comes down to the "greatest common
>denominator" of all the utilities. Based on my experience I'd suggest
>
> 	/^[a-z][a-z\d_-]{1,7}$/
> 
>That's pretty restrictive. In some systems even things like '.' work
>(j.r.hacker@foo.bar) and in some even eight-bit characters work
>(jdger@flip.flop.de). But if you wanna play safe, try the above.

Since when have one-letter usernames become illegal?

-- 
Shimpei Yamashita                  <http://socrates.caltech.edu/%7Eshimpei/>



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

Date: 22 Mar 1997 07:39:00 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: regex for UNIX usernames needed!
Message-Id: <8cybbguh2z.fsf@gadget.cscaper.com>

>>>>> "Jarkko" == Jarkko Hietaniemi <jhi@alpha.hut.fi> writes:

Jarkko> That's pretty restrictive. In some systems even things like '.' work
Jarkko> (j.r.hacker@foo.bar) and in some even eight-bit characters work
Jarkko> (jdger@flip.flop.de). But if you wanna play safe, try the above.

Uh, those are *mail* names.  Not Unix usernames.  I'm speaking from
documentation and practice collected on dozens of implementations of
Unix since 1977 when Unix fit into 32K on a PDP-11.

I seriously doubt you'll find *any* UNIX system out there where in
response to "login:", someone can type "j.r.hacker".

I stand by my original claim.  *Unix* usernames are alphanumeric (not
underscore, not dash), lowercase, and cannot be all digits, and most
utilities are slightly confused when you have something longer than
eight chars.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 528 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: 22 Mar 1997 13:18:02 +0500
From: Mohan Das <mohan@sapna.india.hp.com>
Subject: Re: regex in perl4
Message-Id: <t53ybbg732d.fsf@sapna.india.hp.com>

Bruno Pagis <pagib@aur.alcatel.com> writes:

> 
> I want to extract the second field (the one conaining Ys)
> in the following lines:
> X:Y:Z:
> XXX:YYYY:Z:WW:Q
> ZZ:YY:DD:SSSSSS:HHHHH
> 
> And I'm stuck. In perl5, I would do
> /^.*?:(.*?):.*$/
> but what about perl4 where non-greedy modifiers don't exist.

(split /:/) [1] will give you the second field, but if you want to take 
the regex way, remember that the functionality of non-greedy modifiers
can be achieved through the [^<character class>] construct:
/^[^:]*:([^:]*):.*$/       # looks like a complicated smiley, doesn't it?

mohan



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

Date: 22 Mar 1997 02:28:38 -0800
From: Russ Allbery <rra@cs.stanford.edu>
To: samuell@cis.uab.edu (R L Samuell)
Subject: Re: strange error using anonymous arrays under Solaris but not OS/2
Message-Id: <qumn2rwdxuw.fsf@cyclone.stanford.edu>

[ Posted and mailed. ]

R L Samuell <samuell@cis.uab.edu> writes:

> I developed a set of Perl code examples under Perl5.003 under OS/2 4.0
> for use in a Perl course I recently taught.  When I tested them before
> class under Perl5.000 under Solaris 5.5, I got a strange error message.

Perl 5.000 was horribly buggy.  I recommend not using it.

-- 
Russ Allbery (rra@cs.stanford.edu)      <URL:http://www.eyrie.org/~eagle/>


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

Date: 22 Mar 1997 07:42:28 -0700
From: Vladimir Alexiev <vladimir@cs.ualberta.ca>
Subject: Re: term 'regular expressions' considered undesirable
Message-Id: <omvi6kvvhn.fsf@tees.cs.ualberta.ca>

In article <5gvvha$f55@samba.rahul.net> c.c.eiftj@33.usenet.us.com (Rahul Dhesi) writes:

> In general we cannot implement the search for most perl patterns
> with DFAs or NFAs because most of them require backtracking.

Backtracking is an implementation feature of the perl pattern matcher (ok, of
any reasonable pattern matcher) that has nothingnto do with regularity.

> Because to implement backtracking you must augment the DFA or NFA with
> memory, and once you add memory

I don't know the precise sense in which you use "backtracking" above, but in
eg Prolog it is used to implement nondeterminism (to return all solutions to a
problem). You could find all solutions to a problem with a device that's
capable of cloning itself at every choice point. Which a NFA precisely is.

> It does not remember how it got to that state, so it cannot backtrack.

Nor does it need to. Backtracking is a hack used to model nondeterminism (in a
sense, parallelism) on a sequential computer. You don't need backtracking if
you have NFA in your disposal, and I think you agreed that NFAs are still
regular. (BTW they don't have a higher expressive power than DFA for a "wrong
reason": the simulation of a NFA by a DFA explodes the state space
exponentially, but the exponentiation of a finite number is still finite. This
becomes a concern when you care about the "complexity" of an algorithm, eg
NP-complete problems [the epitome of "exponentially hard" problems] can be
solved in polytime on a NTM; in fact that is the definition of NP.)

> >>> "please ignore Dhesi" -- Mark Crispin <mrc@CAC.Washington.EDU> <<<
In this case I fully agree with Mark.


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 159
*************************************

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