[6361] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 983 Volume: 7

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 20 18:28:15 1997

Date: Thu, 20 Feb 97 15:00:20 -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           Thu, 20 Feb 1997     Volume: 7 Number: 983

Today's topics:
     ?simple? question (Hayes, Dianne)
     Re: ANNOUNCE: GIFgraph 0.9 <mgjv@comdyn.com.au>
     Re: ATTN: EMX Perl users (Perl 5.003_05 for OS/2, Win*  (Fred Elbel)
     Re: backreferences in a character class? (Tad McClellan)
     Re: backreferences in a character class? (Dave Thomas)
     Re: Can I use sockets with Perl for Win95/NT? <osborri@mail.northgrum.com>
     Re: dbmopen() dbmclose() using CGI variables <tchrist@mox.perl.com>
     Re: finding full path to file name (Jason C Austin)
     Re: How to spam - legitimately <valdis.kletnieks@vt.edu>
     Re: html -> text (tedder)
     Re: limit execution time? <egwong@netcom.com>
     Re: limit execution time? <wkuhn@uconect.net>
     modifying @INC <wkuhn@uconect.net>
     Re: newbie needs help (Jagadeesh Venugopal)
     Re: newbie needs help (Dave Thomas)
     Re: Perl Sockets reprise (Mark Allman )
     Perl Utility - compare two directories and make similar <rkc@ll.mit.edu>
     Perl Utility - compare two directories and make similar <rkc@ll.mit.edu>
     Re: PROGRAM: how to check for nice/valid email address <tchrist@mox.perl.com>
     Quick technique to split a words into chars? (Premkumar Natarajan)
     Re: Quick technique to split a words into chars? <wkuhn@uconect.net>
     Re: Regexp to do minimal email validation <tibbs@sina.hpc.uh.edu>
     Re: Simple way to split up a string <jerrym@ibmoto.com>
     Re: sybperl and HTML mpeppler@mbay.net
     Re: What is the best way to find an unique record in a  (Dave Thomas)
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

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

Date: Thu, 20 Feb 1997 15:52:47 -0500
From: dianne.hayes@systecinc.com (Hayes, Dianne)
Subject: ?simple? question
Message-Id: <1997Feb20.152800.1205.102291@smtp.systecinc.com>


I do not know much about perl and think that it might be able do what I   
need.  I was wondering, though, if someone could confirm this before I   
delve into the llama and camel books to figure out how to do it.

Here's what I need to do:

I have two files with (many) rows of data in them.  They were originally   
supposed to be one file, but due to legacy system constraints, the data   
had to be split into two files.  I need to recombine the data in some   
way.  I know that there are three key fields in each file that will   
signify a match for the data.  Is there some way to use perl to match the   
rows, combine them, and put them into a new file?

I am not looking for a complete solution (as I am stubborn and like to   
know how things work), but I would like some sort of confirmation that it   
is possible (and maybe a hint to lead me in the right direction).

Anybody out there have any ideas?


Dianne Hayes  




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

Date: Fri, 21 Feb 1997 08:51:12 +1100
From: Martien Verbruggen <mgjv@comdyn.com.au>
Subject: Re: ANNOUNCE: GIFgraph 0.9
Message-Id: <330CC750.4DD1@comdyn.com.au>

Dave Roth wrote:
> 
> I was under the impression that they would grandfather in products created
> during the "flex" period between the patent's inception and the date they
> announced the crackdown. If this is true, then since the GD library was
> written during this period of time be exempt from any patent infringment?
> And since GD is the graphics lib in this case, wouldn't GIFgraph be exempt
> also? Or am I dreaming? ;)
> Just my $.02,
> dave

This is the answer I got from Unisys when I requested the information
about software in the public domain, referring to that old article they
released way back when..

>>
The press release you refer to is over two years old and is not current.

We still grant free licenses under certain conditions.  However, with
respect to freeware, you and your company would be responsible if any
third
party uses it in a ocmmercial or for profit endeavor; or incorporates it
in
a product.  Experience has shown that written warnings in freeware are
ineffective and will not protect you or your company.

Also, your use of modules "in the public domain" would not negate you or
your company's responsibility in this matter.
>>

This sort of sounds like "It's ok to use LZW compression and GIF stuff
for non-profit software, but if anyone else uses your software for
profit, you're responsible." Seems a bit hard to believe. 

Anyway.. GIFgraph doesn't use the GIF format directly, but through the
GD package. I haven't seen any references in the documentation of GD.pm
or gdlib that address this issue, and will therefore assume that we're
in a safe area. I might just adapt the copyright stuff a little bit to
make things safe for all.

-- 
Martien Verbruggen

Webmaster www.tradingpost.com.au
Commercial Dynamics Pty Ltd, N.S.W., Australia


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

Date: Thu, 20 Feb 1997 20:43:35 GMT
From: __felbel@csn.net__ (Fred Elbel)
Subject: Re: ATTN: EMX Perl users (Perl 5.003_05 for OS/2, Win* and DOS)
Message-Id: <330db638.2137346@news-2.csn.net>

On 18 Feb 1997 20:29:42 GMT, ilya@math.ohio-state.edu (Ilya
Zakharevich) wrote:

> 
> Thanks to Ivan Adzhubei, who discovered the following bug in the
> automatic installer:
> 
> If you did not install your pdksh's sh.exe in f:/bin, check that you
> have PERL_SH_DIR set in Config.sys, and it uses / (not \) - this is a
> bug in the automatic installer - it sets a meaningless PERL_SHPATH
> instead!
> 
> This correction is reported to fix the problem "backticks and pipes do
> not work". Possibly the same fix may work under Win* and DOS?


Thanks for the post - it prompted me to review my install. Referring
to ActiveWare Perl 5.03 for Windows95 (Win32) (Build 302 - Dec. 13,
1996), here is an excerpt from their Windows95 install notes
(win95.txt):

Notes for Windows '95 Users
=====================
Build 105:
----------

Most of the compatibility problems that occured in previous builds are
due to the 16-bit shell (COMMAND.COM) use on Win95.( The problems
included pipes and shell escapes). 

To fix the shell problems, we have shipped a 32-bit shell wrapper with
perl-win32.You can also configure perl to use another shell if you
like.

To change the shell setting you must edit the registry. 

The string:
  HKEY_LOCAL_MACHINE\Software\Microsoft\Resource Kit\PERL5\WIN95SHELL
	must be set to the full path your shell.

================ end excerpt ==============

Their command shell is named /Perl/bin/Cmd32.exe

So after editing my registry (correctly, this time), pipes and
redirection now work.  


--  Fred Elbel  __felbel@csn.net__
--    Address altered to foil spammers
--    To e-mail: delete __ in my return address 


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

Date: Thu, 20 Feb 1997 14:53:30 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: backreferences in a character class?
Message-Id: <akdie5.gb4.ln@localhost>

Brett Denner (dennerbw@lmco.lmtas.com) wrote:

Hi Brett.

: Can I use a backreference in a character class?

: I need to do a pattern match with the following format:

:     $_ = q/ "Hi, 'Fred', or whoever you are." /;

:     /(["'])([^$1]*)$1/ and $string = $2;



/(["'])([^\1]*)\1/ and $string = $2;
          ^    ^


:     print "$string\n";

:     # Which should print:       
:     #     Hi, 'Fred', or whoever you are.
:     # if backreferences in character classes work.

: I am trying to match the first " or ' in a string, and then match every
: character except a " or ' (whichever I first matched) up till the next
: matching " or ' (again, whichever I first matched).  Unfortunately, this
: will only work if I can use the backreference $1 in the character class
: [^$1], which doesn't seem to work in Perl 5.003.  I've looked in the
: Camel 2 book, the FAQ, and man pages without finding a definitive
: answer.

: Should backreferences work in character classes, and if not, is there
: another way to accomplish this?



--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: 20 Feb 1997 21:17:44 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: backreferences in a character class?
Message-Id: <slrn5gpfmn.ncv.dave@fast.thomases.com>

On Thu, 20 Feb 1997 14:53:30 -0600, Tad McClellan <tadmc@flash.net> wrote:
> Brett Denner (dennerbw@lmco.lmtas.com) wrote:
> 
> Hi Brett.
> 
> : Can I use a backreference in a character class?
> 
> : I need to do a pattern match with the following format:
> 
> :     $_ = q/ "Hi, 'Fred', or whoever you are." /;
> 
> :     /(["'])([^$1]*)$1/ and $string = $2;
> 
> 
> 
> /(["'])([^\1]*)\1/ and $string = $2;


Bzzzt! 

Aren't character classes set up at regex compile time?

Certainly

   my $str = 'abcdabcd';
   $str =~ s/(a).*[\1]/XXX/;
   print "$str\n";

doesn't work.

However, you could try using something like (untested)

    /['"](.*?)\1/ and $string = $1;


However, this approach (and the original) won't work with escape characters
in the string.

Regards

Dave

-- 


 _________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: 20 Feb 1997 21:01:49 GMT
From: "Rick Osborne" <osborri@mail.northgrum.com>
Subject: Re: Can I use sockets with Perl for Win95/NT?
Message-Id: <01bc1f71$3f5e2030$1f7fe484@mlbweb>

Chris <webmaster@surewould.com> wrote:
> Well can I?

Nope.  You are not allowed.  I have waved my magical wand and completely
removed all socket functions from your computer.  And whatever you do, do
*not* attempt to read the included help files.  They won't help you
whatsoever, they are only there for decoration and to make Perl look
substantial by taking up more disk space.

_________ o s b o r n e @ g a t e w a y . g r u m m a n . c o m _________
Hacker: One who accidentally destroys.
Wizard: One who recovers afterwards.



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

Date: 20 Feb 1997 22:44:47 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: dbmopen() dbmclose() using CGI variables
Message-Id: <5eik4v$p43$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Tony D'Andrade <blue@visinet.ca> writes:
:
:Hi,  I am having problems passing data to dbmopen() dbmclose() in a cgi 
:script.  If I run the script from the command line and substitute the 
:data from the form with locally defined data, the script works.  Below 
:are both scripts.  Script A works but Script B does not generate the db file.
:
:Any Suggestions ?

    The Idiot's Guide to solving Perl/CGI problems, by Tom Christiansen
	http://www.perl.com/perl/faq/idiots-guide.html

    Frequently Asked Questions about CGI Programming, by Nick Kew
	    ftp://rtfm.mit.edu/pub/usenet/news.answers/www/cgi-faq
	    http://www3.pair.com/webthing/docs/cgi/faqs/cgifaq.shtml

    Perl/CGI programming FAQ, by Shishir Gundavaram and Tom Christiansen
	http://www.perl.com/perl/faq/perl-cgi-faq.html

    The WWW Security FAQ, by Lincoln Stein
	http://www-genome.wi.mit.edu/WWW/faqs/www-security-faq.html

    World Wide Web FAQ, by Thomas Boutell
	http://www.boutell.com/faq/

    Another CGI FAQ, by Marc Hedlund
	http://www.best.com/~hedlund/cgi-faq/

And get thee to the CGI newsgroup.  Your question is unrelated
to Perl.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
Unix is like a toll road on which you have to stop every 50 feet to
pay another nickel.  But hey!  You only feel 5 cents poorer each time.
	--Larry Wall in <1992Aug13.192357.15731@netlabs.com>


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

Date: 19 Feb 1997 17:56:42 GMT
From: jason@wisteria.cs.odu.edu (Jason C Austin)
Subject: Re: finding full path to file name
Message-Id: <JASON.97Feb19125642@wisteria.cs.odu.edu>

In article <3303377F.6A60@net.com> Todd Lowpensky <toddl@net.com> writes:
=> I'm being passed a file name to work on, and I need to
=> figure out the entire path of the file.  The string passed
=> to me may be "../../../motive/file", so it would require
=> a fair amount of work to reconstruct it from the current
=> directory.
=> 
=> I'm using PERL 5 in Solaris.  Any ideas?
=> thanks

	I would use chdir() and then pwd:

sub getpath {
    $_=$_[0];
    my ($dirname, $basename);

    -e $_ || return(0);
    if (-d $_) {
	$dirname=$_;
	$basename=0;
    } else {
	if (!(($dirname,$basename)=m:^ (.*) / ([^/]+) $:x)) {
	    $basename=$_;
	    $dirname='.';
	}
    }
    chomp($pwd=`cd $dirname; pwd`);
    if ($basename) {
	return("$pwd/$basename");
    } else {
	return("$pwd");
    }
}
--
Jason C. Austin
austin@visi.net



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

Date: 20 Feb 1997 17:40:25 -0500
From: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Subject: Re: How to spam - legitimately
Message-Id: <ue3eur14py.fsf@black-ice.cc.vt.edu>

--pgp-sign-Multipart_Thu_Feb_20_17:40:03_1997-1
Content-Type: text/plain; charset=US-ASCII

Chris Schoenfeld <chris@ixlabs.com> writes:

> They want the users to have the ability te request certain daily data
> sent to them via email (they give us the address when they register).
> 
> All of these emails will be different based on user preferences.

Well.. if you have 18,000 different emails, you're going to hand 18,000
things to your MTA.  Your best bet is to do this:

1) Make a connection to your MTA, send a HELO..
2) Start stuffing things down the connection, like tis:

 MAIL FROM:<whatever>
 RCTP TO:<user1@site1.com>
 DATA
 From:
 To:
 Date:
 Subject: 

 Your message here...
 .
 MAIL FROM:<whatever>
 RCTP TO:

and so on...One connection, 18,000 messages.  This will
of course mean your program needs to learn to speak SMTP.
If you'd using Perl, I think there's a SMTP module to help...

--pgp-sign-Multipart_Thu_Feb_20_17:40:03_1997-1
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

-----BEGIN PGP MESSAGE-----
Version: 2.6.2
Comment: Processed by Mailcrypt 3.4, an Emacs/PGP interface

iQCVAwUBMwzS19QBOOoptg9JAQE/4gP/RKX0usXUPpr8hGaYdrPqYhhwTcT1kTOv
gNlKTarsifcMa95qkdZxTAbPc5ihr1S8mB54b10y6eM6z2WIvt2cQhTWK+c4LPKf
rwVNRJidM7f8YDEFfEYuOeWRCpzJ/YEIjGkOT/2LGmCEgzZGidXY2iPANHtGoLB1
dmSMVT+f+Vo=
=H3pN
-----END PGP MESSAGE-----

--pgp-sign-Multipart_Thu_Feb_20_17:40:03_1997-1--


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

Date: 20 Feb 1997 06:07:16 GMT
From: tedder@e-z.net (tedder)
Subject: Re: html -> text
Message-Id: <5egpml$jll@work2.e-z.net>

Randal Schwartz (merlyn@stonehenge.com) wrote:
: LWP is your friend.  Use LWP.

Nooo! I prefer to write code using odd side-effects that rhyme if possible.

LWP isn't my friend.

[sorry, couldn't help it. my inner child needed to express himself]


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

Date: Thu, 20 Feb 1997 20:57:27 GMT
From: Eric Wong <egwong@netcom.com>
Subject: Re: limit execution time?
Message-Id: <egwongE5x67s.6n6@netcom.com>

Murray Stokely <murray@southeast.net> wrote:
:    Is there any way to limit the execution time of a Perl script somehow, in
: case it gets caught in an infinite loop or something.  In csh this would be
: accomplished with "limit cputime 60".  
:  Obviously the goal is just to not make that happen, but I modify this script
: constantly and its called in a crontab so I don't always test it after each
: modification and recently a simple typo crippled the machine when about 10
: processes of the script were stuck in the loop simultaneously.
:   Thanks for any help.

How about using fork()?  Something like:
  #!/usr/local/bin/perl -w
  
  if ($child = fork()) {
    sleep 60;                 # one minute to finish job
    kill 9, $child;
  }
  else {
    # script goes here
  }


[ cc'd ]


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

Date: Thu, 20 Feb 1997 17:17:06 -0500
From: Bill Kuhn <wkuhn@uconect.net>
To: murray@southeast.net
Subject: Re: limit execution time?
Message-Id: <330CCD62.7CE830CE@uconect.net>

Try implementing a timeout.

I got this one out of a perl5 book (not the camel book).

sub alarm_h {
  alarm(0) ;
  exit ;
}

$SIG{'ALRM'} = \&alarm_h ;
$time_out = 10 ; #timeout in seconds
alarm($time_out) ;
#your functions here
alarm(0) ;

-Bill
-- 
Bill Kuhn
Chief Developer
Wired Markets, Inc.
http://www.buyersindex.com


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

Date: Thu, 20 Feb 1997 16:26:14 -0500
From: Bill Kuhn <wkuhn@uconect.net>
Subject: modifying @INC
Message-Id: <330CC176.699B8232@uconect.net>

I want to do something like the following in a CGI program, but I am not
being very successful:

# $ENV{SERVER_PORT} is set
$incpath = '/home/cgi-lib.' . $ENV{SERVER_PORT} ;
use lib "$incpath"
# use a module in the modified @INC
use somemodule
 .
 .
 .

When I try to compile the above it fails.  It tried to
push(@INC,$incpath) but the same results were obtained.

If I print "@INC" it appears modified as I requested, but I can't seem
to use modules in the new include path.

Any suggestions?

Thanks.

-Bill
-- 
Bill Kuhn
Chief Developer
Wired Markets, Inc.
http://www.buyersindex.com


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

Date: 20 Feb 1997 20:42:02 GMT
From: jvenu@ctp.com (Jagadeesh Venugopal)
Subject: Re: newbie needs help
Message-Id: <5eicuq$71u@concorde.ctp.com>

In article <5eid0b$ta@hermes.uhland.de> gerd4000@mailszrz.zrz.TU-Berlin.DE (Gerd Schering) writes:
>
>-- 
>Hello,
>first of all I hope I hit the right group (but as i am a newbie, please pardon
>me!)
>I have the following problem:
>I want to traverse a directory tree:
>I start at a given directory (=$startdir) and I want to put all subdirs on a
>stack for later processing. But something goes wrong with (my use of) the file
>test operator: the stack is always empty - though there are subdirs.
>So what's wrong?
>----------------------------------------------------------------------------- 

Maybe I am missing something, but why are you not using File::Find?

Jag

-- 
 /\/\ |Jagadeesh K. Venugopal, jvenu@ctp.com |http://w3.ctp.com/~jvenu 
/ /_.\|Cambridge Technology Partners, Inc.   |http://www.ccs.neu.edu/home/jkvg 
\  /./|304 Vassar St.  Cambridge, MA 02139   |
 \/\/ |Phone: 617.374.2028 FAX: 617.374.8300 +


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

Date: 20 Feb 1997 21:31:01 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: newbie needs help
Message-Id: <slrn5gpgfl.ncv.dave@fast.thomases.com>

On 20 Feb 1997 20:42:51 GMT, Gerd Schering <gerd4000@mailszrz.zrz.TU-Berlin.DE> wrote:
> 
> $startdir = $ARGV[0];
> opendir(STARTDIR, $startdir);
> @infiles = readdir (STARTDIR);
 ... 
> while ($name = shift(@infiles)) {
>     if (-d $name) {
> 	print "dir: ", $name, "\n";

Readdir returns just the names of the files. If you invoke your script as 

   script  /usr
   
then readdir returns the names in /usr. However, your current directory may
not be /usr, so the test -d $name won't find the direcory. Replacing it with
  -d "$startdir/$name
  
should fix it.

Have you looked at File::Find - I'm not sure it saves you much in your
current example, but if you wanted to look recursively through
sub-directories of $startdir it would make your life simpler.

Regards

Dave

-- 

 _________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: 20 Feb 1997 20:30:21 GMT
From: allman@pat.mdc.com (Mark Allman )
Subject: Re: Perl Sockets reprise
Message-Id: <5eic8t$6r1@cisu2.jsc.nasa.gov>

In article <856399272.7057@dejanews.com>, msosteri@yesic.com writes:
|> In article ,
|>   tom@palver.nospam.eiscat.no (Tom Grydeland) wrote:
|> >
|> >
|> > From the pink camel, p.174 or the blue camel, p.211:
|> 
|> Bizarre, obscure AND NITPICKY, in my "RED" Camel the select Function
|> is on page 177.
|> >
|> >   select((select(STDERR), $|=1)[0])
|> 
|> I think I got it. This cryptic incantation "selects" STDERR, gives PERL
|> control over output buffering and then "selects" the previous filehandle
|> (whatever that was) via the return value of the inner select. But select
|> returns the previously selected filehandle as a scalar? Why the array
|> offset [0]?
|> 
|> -------------------==== Posted via Deja News ====-----------------------
|>       http://www.dejanews.com/     Search, Read, Post to Usenet

To translate this to english:

    (select(STDERR), $|=1)

is a list with two elements: whatever "select(STDERR)" returns and
whatever "$|=1" returns.  Since "select(STDERR)" returns the previously-
selected filehandle, the construct "(select(STDERR), $|=1)[0]" picks
that out of the list, so "select((select(STDERR), $|=1)[0])" is just
a (needlessly, IMHO) cryptic way to do the following:
    $i = select(STDERR);
    $|=1;
    select( $i );

Is the "select((select(STDERR), $|=1)[0])" faster?  Yes and no.  It
executes faster (probably, but I haven't tested it), however, it takes
longer for the another programmer to decypher six months later.

One of the problems I've had to face getting Perl accepted is the
complaint that Perl is "too cryptic, too hard to read."  Hey, folks,
they (System Administrators, other software people I work with, etc.)
say it, not me.  I'm just fighting the battles.  

-- Mark Allman
-- Sr. Engineer, McDonnell Douglas Aerospace,  allman@pat.mdc.com
-- Software consulting (Perl, C, Python, ...), ghost@ghost.neosoft.com
-- (see: http://pup.princeton.edu/titles/5857.html)


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

Date: 20 Feb 1997 17:02:57 -0500
From: Rob Cunningham <rkc@ll.mit.edu>
Subject: Perl Utility - compare two directories and make similar
Message-Id: <ospvxvt9ta.fsf@mi-tremor.i-have-a-misconfigured-system-so-shoot-me>

I've searched the web for a simple utility that would do the following, but to
no avail.  Does anybody have a tool that:
	Compares two nearly identical directories and their subdirectories.
	Determines which directory has the most recent copy of a given file.
	Copies that file on top of the older version of the file.

I need something like this for working on two copies of a single source tree
that periodically need to be merged back together.

This seems like something that anybody who has a portable computer would need
to have, so before I write a quick and dirty thing, let me ask to see if
something polished is out there.

Thanks in advance for your help...

				-Rob

-------------------------------------------------------------------------------
                          Robert K. Cunningham
                           rkc@xn.ll.mit.edu
Machine Intelligence Group		     Cognitive and Neural Systems Dept.
  MIT Lincoln Laboratory                              Boston University
*** My comments, my opinions: my responsibility.


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

Date: 20 Feb 1997 17:01:23 -0500
From: Rob Cunningham <rkc@ll.mit.edu>
Subject: Perl Utility - compare two directories and make similar
Message-Id: <osvi7nt9vw.fsf@mi-tremor.i-have-a-misconfigured-system-so-shoot-me>

I've searched the web for a simple utility that would do the following, but to
no avail.  Does anybody have a tool that:
	Compares two nearly identical directories and their subdirectories.
	Determines which directory has the most recent copy of a given file.
	Copies that file on top of the older version of the file.

I need something like this for working on two copies of a single source tree
that periodically need to be merged back together.

This seems like something that anybody who has a portable computer would need
to have, so before I write a quick and dirty thing, let me ask to see if
something polished is out there.

Thanks in advance for your help...

				-Rob

-------------------------------------------------------------------------------
                          Robert K. Cunningham
                           rkc@xn.ll.mit.edu
Machine Intelligence Group		     Cognitive and Neural Systems Dept.
  MIT Lincoln Laboratory                              Boston University
*** My comments, my opinions: my responsibility.


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

Date: 20 Feb 1997 22:36:35 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: PROGRAM: how to check for nice/valid email address
Message-Id: <5eijlj$p43$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    jon@amxdigital.com (Jonathan Peterson) writes:
:#Program gathers an email address, does as much
:#checking as is reasonable, and adds it to a list.

Did you not see this program?

--tom

#!/usr/bin/perl
#
# addrcheck - mail address checker
# by tchrist@perl.com
# Copyright 1997 Tom Christiansen
# version 1.001 Fri Feb 14 15:20:02 MST 1997

####################################
# this program takes an email address as its argument
# and decides whether you're being spoofed or not.
# it exists 0 if it likes the address, and 1 if it doesn't.
# 
# can be tested interactively.  if not interactive, it will
# use syslog.
#
# should be rewritten instead of just growing via hacks.
####################################

$LOGGER   = '/usr/bin/logger';  # or /usr/ucb?
$NSLOOKUP = '/usr/bin/nslookup';  # or /usr/ucb?

$DEBUG = -t STDIN && -t STDOUT;
$address = shift || die "usage: $0 address\n";

for ($address) {
    s/^-+//;
    tr/A-Z/a-z/;
}

($user, $host) = split /\@/, $address;

# we check in this order because of speed;
# this way it will fail more quickly.

check_passwd($user);	# picky

if ($address =~ /\@./) { 
    check_host($host);
    ck822($address);   	# inscrutable
    dns_check($host);  	# slow
}

exit 0;

####################################
 
sub bad {
    # GLOBAL $hispass and $what
    if ($DEBUG) {
	print "$what `$hispass' is bad: @_\n";
    } else {
	system $LOGGER,
		    "-p", "daemon.notice", 
		    "-t", "ftpucheck",
		"BOGUS \U$what\E $hispass (@_)";
    } 
    exit 1;
} 

####################################

#############

sub check_passwd {  
    local $what = 'user';
    local $hispass = shift;

    for (@rude) {
	bad("rude") if index($hispass, lc $_) != -1;
    } 

    for (@anywhere) {
	bad("inside") if index($hispass, lc $_) != -1;
    } 

    for (@full) {
	bad("full") if $hispass eq lc $_;
    } 

    for (@start) {
	bad("start") if index($hispass, lc $_) == 0;
    } 

    # single char
    bad("single") if length($hispass) == 1;

    study $hispass;

    bad("dup letters") if $hispass =~ /(\w)\1{3,}/;

    bad("white") if $hispass =~ /\s/;

    bad("junk") if $hispass =~ /[;,\/#^*]/;

    $V = 'aeiouy';
    if ($hispass =~ /netscape/ || $hispass =~ /^m[$V]*[sz]+[$V]*l+[$V]*\W*$/) {
	bad("mozilla");
    } 

    if ($hispass =~ /xyz+y/) {
	bad("xyzzy");
    } 

    # all same letter
    bad("dup letters") if $hispass =~ /^(.)\1+$/;

    # want letters
    bad("ugly") unless $hispass =~ /[a-z]/;

    bad("backspace") if $hispass =~ /[\010\177]/;

    $letters = "qwertyuiopasdfghjklzxcvbnmmnbvcxzlkjhgfrdsapoiuytrewq";

    # consecutive
    bad("consecutive") if 
	    length($hispass) > 2 &&
		( index($letters, $hispass) != -1
		    ||
		  ($hispass =~ /^(\w+)\1$/ && length($1) > 2
		    && index($letters, $1) != -1)
		);

    print "$what: $hispass is good\n" if $DEBUG;

}


#############

sub check_host {
    local $what = 'host';
    local $hispass = shift;

    bad("dotless") unless index($hispass, '.') >= 0;

    for (@rude) {
	bad("rude") if index($hispass, lc $_) != -1;
    } 

    for (@full) {
	bad("full") if $hispass eq lc $_;
    } 

    # single char
    bad("single") if length($hispass) == 1;

    study $hispass;

    bad("white") if $hispass =~ /\s/;

    bad("junk") if $hispass =~ /[;,\/#^*]/;

    # want letters, darnit;  this will cause 127.1 to fail though
    bad("ugly") unless $hispass =~ /[a-z]/;

    bad("backspace") if $hispass =~ /[\010\177]/;

    $letters = "qwertyuiopasdfghjklzxcvbnmmnbvcxzlkjhgfrdsapoiuytrewq";

    # consecutive
    bad("consecutive") if 
	    length($hispass) > 2 &&
		( index($letters, $hispass) != -1
		    ||
		  ($hispass =~ /^(\w+)\1$/ && length($1) > 2
		    && index($letters, $1) != -1)
		);

    print "$what: $hispass is good\n" if $DEBUG;

}

sub dns_check {
    # first try an MX record, then an A rec (for badly configged hosts)

    my $host = shift;
    local $/ = undef;
    local $what = "DNS record";
    local $hispass = $host;


    # the following is comment out for security reasons:
    #	if ( `nslookup -query=mx $host` =~ /mail exchanger/
    # otherwise there could be naughty bits in $host
    # we'll bypass system() and get right at execvp()

    if (open(NS, "-|")) {
	if (<NS> =~ /mail exchanger/) {
	    print "$what MX: $hispass is good\n" if $DEBUG;
	    close NS;
	    return;
	}
    } else {
	open(SE, ">&STDERR");
	open(STDERR, ">/dev/null");
	exec $NSLOOKUP, '-query=mx', $host;
	open(STDERR, ">&SE");
	die "can't exec nslookup: $!";
    } 

    if (open(NS, "-|")) {
	$_ = <NS>;
	if (/answer:.*Address/s) {
	    print "$what A: $hispass is good\n" if $DEBUG;
	    close NS;
	    return;
	}
	if (/Name:.*$host.*Address:/si) {
	    print "$what A: $hispass is good\n" if $DEBUG;
	    close NS;
	    return;
	}
    } else {
	open(SE, ">&STDERR");
	open(STDERR, ">/dev/null");
	exec $NSLOOKUP, '-query=a', $host;
	open(STDERR, ">&SE");
	die "can't exec nslookup: $!";
    } 

    bad("No DNS");
} 


sub ck822 { 

    # ck822 -- check whether address is valid rfc 822 address
    # tchrist@perl.com
    #
    # pattern developed in program by jfriedl; 
    # see "Mastering Regular Expressions" from ORA for details

    # this will error on something like "ftp.perl.com." because
    # even though dns wants it, rfc822 hates it.  shucks.

    local $what = 'address';

    local $hispass = shift;
    local $_;

    $is_a_valid_rfc_822_addr = '';

    while (<DATA>) {
	chomp;
	$is_a_valid_rfc_822_addr .= $_;
    } 


    bad("rfc822 failure") unless $hispass =~ /^${is_a_valid_rfc_822_addr}$/o;
    print "$what: $hispass is good\n" if $DEBUG;
}

##############################
# initializations
##############################

BEGIN {

    @full = qw{

	admin
	anon
	anonymous
	bar
	big-liar
	bin
	bizarre
	bla
	blah
	bogus
	bummy
	cache
	collect
	compuserve
	cool
	crud
	DeleGateMaster
	devnull
	dialup
	dork
	dummy
	dunno
	employee
	first1
	foo
	friendly
	ftpsearch-collect
	fu
	god
	guest
	gunk
	gw
	harvest
	here
	hi
	ident
	ident
	ie30user
	info
	informix
	internet
	junk
	liar
	login
	lycos
	maxima
	me
	mirror
	mosaic
	nobody
	none
	none-known
	nouser
	ntcon
	ok
	outbound
	postmaster
	president
	public
	Put_Your_Email_Address
	report_abuse
	root
	satan
	socks
	spanky
	src
	sticky
	system
	there
	unknown
	Unknown_Netscape_User
	Unregistered
	unverified
	user
	UserName
	vice-president
	vividnet
	whoever
	WinGate
	wow
	xyz
	xyz

    };

    @start = qw{

	aaa
	abc
	account
	anon
	anon
	asquid
	daemon 
	delegate
	ftp
	gopher
	gotch
	oracle
	otthttp
	pass
	satan
	squid
	student
	test
	web
	xx

    };

    @anywhere = qw{

	adresse
	asdf
	address
	asfd
	cache
	firewall
	-gw
	http
	mail
	mirror
	mother
	name
	nobody
	proxy
	sadf
	system
	user
	www

    }; 

    @rude = qw{

	asshole
	crap
	cunt
	damn
	fuck
	piss
	shit
	suck
	tits
	upyour

    };

}

# don't touch this stuff down here or you'll break the rfc822 matcher.
__END__
(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n
\015()]|\\[^\x80-\xff])*\))*\))*(?:(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\
xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"(?:[^\\\x80-\xff\n\015"
]|\\[^\x80-\xff])*")(?:(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xf
f]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*\.(?:[\040\t]|\((?:[
^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\
xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;
:".\\\[\]\000-\037\x80-\xff])|"(?:[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*"))
*(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\
n\015()]|\\[^\x80-\xff])*\))*\))*@(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\
\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\04
0)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-
\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((?
:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80
-\xff])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\(
(?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]
\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\
\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\]))*|(?:[^(\040)<>@,;:".\\\[\]\000-\0
37\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"(?:[^\\\x80-\xf
f\n\015"]|\\[^\x80-\xff])*")(?:[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\03
7]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\
\[^\x80-\xff])*\))*\)|"(?:[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*")*<(?:[\04
0\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]
|\\[^\x80-\xff])*\))*\))*(?:@(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x
80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@
,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]
)|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((?:[^\\
\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff
])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^
\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-
\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-
\xff\n\015\[\]]|\\[^\x80-\xff])*\]))*(?:(?:[\040\t]|\((?:[^\\\x80-\xff\n\01
5()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*,(?
:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\0
15()]|\\[^\x80-\xff])*\))*\))*@(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^
\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<
>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xf
f])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((?:[^
\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\x
ff])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:
[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\00
0-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x8
0-\xff\n\015\[\]]|\\[^\x80-\xff])*\]))*)*:(?:[\040\t]|\((?:[^\\\x80-\xff\n\
015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*)
?(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000
-\037\x80-\xff])|"(?:[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*")(?:(?:[\040\t]
|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[
^\x80-\xff])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xf
f]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\
\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"(?:
[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*"))*(?:[\040\t]|\((?:[^\\\x80-\xff\n\
015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*@
(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n
\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff
]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\
]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\
xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*\.(?:[\040\t]|\((?
:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80
-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@
,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff
])*\]))*(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x8
0-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*>)(?:[\040\t]|\((?:[^\\\x80-\xff\n\
015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
    Chip Salzenberg sent me a complete patch to add System V IPC (msg, sem and
    shm calls), so I added them.  If that bothers you, you can always undefine
    them in config.sh.  :-) --Larry Wall in <9384@jpl-devvax.JPL.NASA.GOV>


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

Date: 20 Feb 1997 21:50:07 GMT
From: pnataraj@emerald.tufts.edu (Premkumar Natarajan)
Subject: Quick technique to split a words into chars?
Message-Id: <5eiguf$gnj@d2.tufts.edu>

Is there a quick way to split words into chars, something like 

@chars = choptochars($string);

Currently I am doing it using chop in a loop terminated at length of the
string.

Thanks

Prem


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

Date: Thu, 20 Feb 1997 16:59:48 -0500
From: Bill Kuhn <wkuhn@uconect.net>
To: Premkumar Natarajan <pnataraj@emerald.tufts.edu>
Subject: Re: Quick technique to split a words into chars?
Message-Id: <330CC954.354031B7@uconect.net>

try
@chars = split(//,$string) ;

-- 
Bill Kuhn
Chief Developer
Wired Markets, Inc.
http://www.buyersindex.com


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

Date: 20 Feb 1997 14:54:28 -0600
From: Jason L Tibbitts III <tibbs@sina.hpc.uh.edu>
Subject: Re: Regexp to do minimal email validation
Message-Id: <ufa4tf7qjuj.fsf@sina.hpc.uh.edu>

>>>>> "EtB" == Eli the Bearded <usenet-tag@qz.little-neck.ny.us> writes:

EtB> While you can't check for sure, here is/was my quick and dirty check
EtB> for a reasonable From: line in mail:

[regexp nuked]

Ugh.  This stuff is really hard to do.  I hacked up some gross code to do
basic syntactic validation for addresses, the result of which is at
ftp.hpc.uh.edu:/pub/majordomo/validate_addresses.  Try not to hurl; the
code is just a proof of concept.

You can call it with the name of a file containing addresses (one per line)
and it will check them, or it will check an internal set of addresses.  It
tries hard to give a useful indication of why the address is illegal.  You
can edit a few variables to allow some more common illegal but useful
errors.

If you find places where this code could be improved, just let me know.
-- 
      Jason L. Tibbitts III - tibbs@uh.edu - 713/743-8684 - 221SR1
System Manager:  University of Houston High Performance Computing Center
                1994 PC800 "Kuroneko"      DoD# 1723


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

Date: Thu, 20 Feb 1997 14:48:30 -0600
From: Jerry Monsen <jerrym@ibmoto.com>
To: Richard Arnesen <rdarnese@nortel.ca>
Subject: Re: Simple way to split up a string
Message-Id: <330CB89E.41C6@ibmoto.com>

Richard Arnesen wrote:
> 
> Let's say I have a string of this format...
> 
> Richard (asds)
> 
> Okay I want to ignore everything after the first whitespace.
> What's the easiest way to do this??
> 
> TIA
> 
> --
> Richard D. Arnesen Jr.              "Bill Clinton's Promises have the
> Unix DCA Support, Nortel            lifespan of a Big Mac on AirForce
> The opinions expressed are MINE     One" - Rep. Susan Molinari
> no else can have them               Romans 6:23, 1Cor 4-8, John 3:16
Two ways come to mind.

#! /usr/local/bin/perl -w
  
$string = 'Richard (asds)';
($newstring) = split(/\s/, $string);
print "$newstring\n";
$string =~ s/\s.*$//;
print "$string\n";

results in:
Richard
Richard

Jerry Monsen


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

Date: Thu, 20 Feb 1997 15:12:37 -0600
From: mpeppler@mbay.net
To: barg@nickel.as.arizona.edu
Subject: Re: sybperl and HTML
Message-Id: <856472892.14786@dejanews.com>

In article <5ei27k$l1o@news.ccit.arizona.edu>,
  barg@nickel.as.arizona.edu (Irene Barg) wrote:
>
> Hello,
>
> I'm running sybperl-2.05 on a Sun SPARCstation 20, Solaris 2.5.
>
> I get the following error when I try to load a
> CGI form which will eventually call some sybperl subroutines.
>
> Error: HTTPd: malformed header from script
/d4/sybase/www/docs/htdocs/cgi-bin/test/target
>
> The top of the CGI form looks like this:
>
> #!/net/nickel/d0/barg/bin/perl
> # Sybperl stuff
> use Sybase::CTlib;
> BEGIN {$ENV{SYBASE} = "/d0/sybase/sybase10"; unshift @INC, "../../lib";}

You may get bitten by one of to things...

First I'd suggest useing

use lib "../../lib";

instead of the unshift(@INC), and place it before calling 'use
Sybase::CTlib'

Second, you may also hit hte infamous LD_LIBRARY_PATH problem...

The Sybase::CTlib module relies on a bunch of dynamic libraries provided
by Sybase, and that usually are found in $SYBASE/lib. Depending on how
you built sybperl, you may not be able to run your scripts without
setting the LD_LIBRARY_PATH environement variable to point to the Sybase
lib directory. Unfortunately, most http servers do not pass
LD_LIBRARY_PATH to their children, so you may have to use a wrapper (I've
used a simple shell wrapper to do this:

#!/bin/sh
LD_LIBRARY_PATH=/usr/local/sybase/lib
export LD_LIBRARY_PATH
exec the_real_cgi_script

Michael

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


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

Date: 20 Feb 1997 21:24:07 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: What is the best way to find an unique record in a file?
Message-Id: <slrn5gpg2m.ncv.dave@fast.thomases.com>

On 20 Feb 97 04:27:03 GMT, Xiang Kong <kong@starnetinc.com> wrote:
> I have a 500,000-record file which keyed by a unique number.
> I want to find record 399,999's value.
> Can you tell me what the file's format should be for best way to find that
> record?
> Best way means the simplest and the quickest way.


Tell us:
  - Fixed or variable length records?
  - Is the unique number the record number, or something else (in your example
    above, do you really mean the 399,999'th record or the record with the
    unique key 399,999?)
  - Are there lots of updates?
  - Will multiple people be reading and writing at the same time?

_then_ we can say...

Any answer without knowing more is making assumptions.

Dave



-- 

 _________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: 8 Jan 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Jan 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.

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 V7 Issue 983
*************************************

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