[7213] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 838 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 9 16:07:43 1997

Date: Sat, 9 Aug 97 13:00:22 -0700
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, 9 Aug 1997     Volume: 8 Number: 838

Today's topics:
     Broken Pipe?? <gonzales@musictech.com>
     Re: Buy any Perl book in print (Terje Bless)
     Re: can regexp do balanced match? <jhpb@sarto.gaithersburg.md.us>
     chop vs chomp <Benarson.Behajaina@swh.sk>
     Re: DBM Equivalent for NT (Chris Nandor)
     Re: Got an error in DBM (Mike Heins)
     Help please : getting rid of double CR control characte <GeoffW@wordsmith.demon.co.uk>
     Re: Help please : getting rid of double CR control char (Mike Stok)
     Re: Help! - Reformatting Date <rootbeer@teleport.com>
     Re: How do I save a hash in a file? (robert)
     How to secure data? (Scott Card)
     Re: Is there a perl IDE? (Andrew M. Langmead)
     MS-DOS port of the Perl programming language >?F<@jumbo.com
     Newbie - Perl for Win <jerryp.usenet@SPAMconnected.demon.co.uk>
     Re: Perl and Windows NT <rootbeer@teleport.com>
     Re: printf <petri.backstrom@icl.fi>
     Problem installing 5.004_02 on MkLinux / Dynamic Loadin (Chris Nandor)
     Re: Regexp <dboorstein@ixl.com>
     Re: Running Perl under Windows - No NFS <petri.backstrom@icl.fi>
     Re: Searching for "similar" words <jefpin@bergen.org>
     Re: Searching for "similar" words <jefpin@bergen.org>
     snobol5-like parser for PERL? <jhpb@sarto.gaithersburg.md.us>
     Strange shebang behavior in linux <alexlane@ghg.net>
     URGENT! Help needed!! <R.Bloeth@ping.de>
     Re: URGENT! Help needed!! <R.Bloeth@ping.de>
     Re: URGENT! Help needed!! (Mike Stok)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sat, 09 Aug 1997 06:36:30 +0000
From: Philip Gonzales <gonzales@musictech.com>
Subject: Broken Pipe??
Message-Id: <33EC0FE2.6C317FFE@musictech.com>

Hello,

I'm using the "Formmail" (Matt's Scripts, Inc.) Perl script, modified
for my purposes, and I keep getting the message that Netscape has
encountered a "Broken Pipe".  I have tried the script on Unix and on NT
(the NT version, or course), but keep getting the same message.

I also checked that all the fields in the form, even the hidden fields,
are set to send data to the script.  I was led to believe that this
could cause a "Broken Pipe" message.

Any suggestions?

Thanks much.

DataDogs
gonzales@musictech.com  
 



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

Date: Sat, 09 Aug 1997 16:34:39 +0200
From: link@tss.no (Terje Bless)
Subject: Re: Buy any Perl book in print
Message-Id: <link-0908971634390001@news.uit.no>

In article <10v4s5.f97.ln@localhost>,
    Tad McClellan <tadmc@flash.net> wrote:

>In article <5s4qou$g9l@fridge-nf0.shore.net>,
>    Ira Krakow <ikrakow@shore.net> wrote:
>
>>Which Perl books are the best?
>
>best for what?
>
>Learning Perl?   ("Learning Perl")
>A reference for Perl?  ("Programming Perl")
>
>Learning how to program? (some would say a a book about some language
>                          other than Perl...)

Gawd, how I would love a book that teaches you to program and does so using
Perl as the example language. Algorithms and datastructures demonstrated in
Perl rather than Pascal.

Well, I can can dream, can't I? :-)

-- 
Party? Party, lord? Yes, lord. Right away, lord.
        - Beopunk Cyberwulf


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

Date: Sat, 09 Aug 1997 10:12:59 -0400
From: "Joseph H. Buehler" <jhpb@sarto.gaithersburg.md.us>
Subject: Re: can regexp do balanced match?
Message-Id: <33EC7AEB.65A993E3@sarto.gaithersburg.md.us>

doritozilla wrote:
> 
> I'm trying to tokenize a postscript language
> file: so far regexp's have been able to do
> it all but I'm worried about the following
> case where I must gather everything inside ( )'s.
> postscript allows the ( ) to be quoted to represent
> the actualy character and not be string delimiter.

> is there some regexp magic to be able to
> count the quoted parentheses. or must I
> resort to my C coding mentality of examing
> the string character by character and doing
> the housekeeping myself?

Regular expressions are not sufficiently powerful to
parse arbitrarily nested parentheses.  You *can* handle
nested expressions to a certain depth, but not
arbitrary nesting, and even then, it is easy to write
a regular expression too complicated for PERL to handle.

You can either handle the bookkeeping yourself, as you
suggest, or use something like YACC, which is designed
to build parsers that handle this sort of thing.

Joe Buehler


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

Date: Wed, 06 Aug 1997 14:40:38 +0200
From: Benarson Behajaina <Benarson.Behajaina@swh.sk>
Subject: chop vs chomp
Message-Id: <33E870C5.F80C7CCF@swh.sk>

I've just looked at the perlfunc manual (on Solaris 2.5) but couldn't
find
the difference between :
1. chop and chomp
2. localtime and gmtime

So could someone explain if chop and chomp are the same ?

                    Benarson.



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

Date: Sat, 09 Aug 1997 15:06:14 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Re: DBM Equivalent for NT
Message-Id: <pudge-ya02408000R0908971506140001@news.idt.net>

In article <19970808182701.OAA20457@ladder02.news.aol.com>, cowbys@aol.com
(COWBYS) wrote:

# Does anyone know of an equivalent of DBM for NT ?
# OR
# besides associative arrays, a way of using NT Perl (Perl for Win32) to
# search a file consisting of fixed length records and pulling out certain
# records, sort of like an associative array but there are multiple fields
# in each record, not just a key and a value...
# 
#  any help appreciated. please reply to dave_fortenberry@attcapital.com

MacPerl comes with DB_File ... :-)

I have no idea if Win32 Perl has any of the DBM packages ported over, but I
just thought it was really really cool that Matthias Neeracher brought
DB_File over to the Macs.

--
Chris Nandor             pudge@pobox.com             http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])


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

Date: 6 Aug 1997 19:03:08 GMT
From: mheins@prairienet.org (Mike Heins)
Subject: Re: Got an error in DBM
Message-Id: <5sahpc$st2$1@vixen.cso.uiuc.edu>

Morten Simonsen (mortensi@idt.ntnu.no) wrote:
: Hi
: 
: I am running a database which seems to work fine at startup. But when
: the database grows to a larger size, I get this message (and the program
: won't run):
: 
: ndbm store returned -1, errno 28, key "19970806$lnk" at 
: /home/stud/mortensi/public_html/USERBIN/dev-sms/sms_lib.pm line 681.
: 
: What does errno 28 mean, I couldn't find any information about it 
: in the header files, so if anyone could give me a hint, it would be
: nice. Line 681 in this program follows here:

It will be shown in /usr/include/sys/errno.h, or shome
other UNIX include.  ENOSPC is the error.

It means you are trying to write more key/value data
than your DBM can handle.  NDBM and SDBM are often limited
to 1024  or 4096 bytes.

: 
: $$databaseref{$key} = $attributelist;
: 
: I think this is the first time in the program that I try to write the
: database. It works correctly at the beginning, but now (the databasesize 
: is only about 30K) it gets a little ugly...
:

This looks doubtful.  I you have used tie(), you should
be able to set the tied variable directly without using a reference.

-- 
Regards,
Mike Heins

This post reflects the
opinion of my employer.


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

Date: Sat, 9 Aug 1997 19:30:06 +0100
From: Geoff Wilkins <GeoffW@wordsmith.demon.co.uk>
Subject: Help please : getting rid of double CR control characters
Message-Id: <7snnxAAucL7zEwY+@wordsmith.demon.co.uk>

I'm writing some Perl script to do various conversion-jobs on downloaded
HTML files.  (I'm working in a DOS environment.) 

I've hit a problem.  A few of the downloaded HTML files have double
carriage-returns in them, i.e. hex 0D 0D.  I want to change these to
carriage return followed by line-feed, i.e. hex 0D 0A.  (I am of course
inspecting the files before and after with a hex-editor.)

Whatever I've tried, the best I've managed is changing the double 0Ds to
a single 0D.  I assume that this is something to do with the way Perl
deals with newlines.

I've tried enabling "paragraph mode", but this doesn't seem to help.

Any suggestions, please, either to here or by e-mail to
GeoffW@wordsmith.demon.co.uk.

(If I can't do it by Perl, is there some other simple way of doing this
under DOS, preferable working on batches of files?  I can of course do
it with the Replace All function of my hex-editor, but only working on
one file at a time.)
-- 
Geoff Wilkins

34 Farnham Road, Handsworth, Birmingham B21 8EG, UK, 
                telephone: 0121-554 8264


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

Date: 9 Aug 1997 18:50:26 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Help please : getting rid of double CR control characters
Message-Id: <5sie5i$5e3@news-central.tiac.net>

In article <7snnxAAucL7zEwY+@wordsmith.demon.co.uk>,
Geoff Wilkins  <GeoffW@wordsmith.demon.co.uk> wrote:
>I'm writing some Perl script to do various conversion-jobs on downloaded
>HTML files.  (I'm working in a DOS environment.) 
>
>I've hit a problem.  A few of the downloaded HTML files have double
>carriage-returns in them, i.e. hex 0D 0D.  I want to change these to
>carriage return followed by line-feed, i.e. hex 0D 0A.  (I am of course
>inspecting the files before and after with a hex-editor.)
>
>Whatever I've tried, the best I've managed is changing the double 0Ds to
>a single 0D.  I assume that this is something to do with the way Perl
>deals with newlines.
>
>I've tried enabling "paragraph mode", but this doesn't seem to help.
>
>Any suggestions, please, either to here or by e-mail to
>GeoffW@wordsmith.demon.co.uk.

You could try

  perl -0777 -pi.bak -e 's/\x0d\x0d/\x0d\x0a/g' *.html

or in a program set $/ to undef which lets you slurp an entire file at a
time into a scalar.  If that's likely to eat too much memory you could say
something like this:

  $/ = "\x0d\x0d";
  $\ = "\x0d\x0a";

  # open INPUT & OUTPUT streams

  while (<INPUT>) {
    chomp or $\ = '';		# remember to reset if doing >1 file
    print OUTPUT;
  }

  # close INPUT and OUTPUS streams

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Wed, 6 Aug 1997 07:07:57 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Victor Tolbert <vtolbert@mindspring.com>
Subject: Re: Help! - Reformatting Date
Message-Id: <Pine.GSO.3.96.970806070726.29767E-100000@kelly.teleport.com>

On Mon, 4 Aug 1997, Victor Tolbert wrote:

> What I would rather have is a simple date format 

There's a module on CPAN which will help you. Good luck!

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

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 7 Aug 1997 10:26:06 +0200
From: robert@ICK.il.fontys.nl (robert)
Subject: Re: How do I save a hash in a file?
Message-Id: <5sc0qu$al@bsd1.hqehv-internal.ilse.net>

stupid@wco.com (Eric Penn):
 >I can create a hash.  I can manipulate a hash.  I can even print out a hash.
 >But short of converting the hash into a list and saving that to a data file
 >(which seems ugly to me) there seems to be no way to save a hash to a file
 >for later retrieval.
 >Am I missing somthing, or is this just The Way Things Are (tm)?

You should take a look at modules like DB_File, NDBM_File or SDBM_File.
What they do is they 'tie' a hash-variable to a database-file, all quite
transparent for the user.

Here's a code-snippet:
--
use SDBM_File;		# comes with Perl (don't know about Windows/Mac
                        # versions, though). If you're on Unix, you might
			# want to try DB_File instead.

tie %hash, SDBM_File, "databasefilename", O_CREAT|O_RDWR, 0664 || die "tie";

 ..use %hash just as you normally would use a hash variable..

untie %hash;		# this sends a message to the backend to store
                        # whatever of %hash is in memory into a special
			# file (named 'databasefilename').
--

When you tie a hash-variable using any of the DB-modules, all accesses to
%hash will trigger special functions in the module, which in their turn
will interface with the db-lib.

                                                                    robert


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

Date: Sat, 09 Aug 1997 18:29:37 GMT
From: ils@pipcom.com (Scott Card)
Subject: How to secure data?
Message-Id: <33ecb6d9.1009356@news.pipcom.com>

After data on a form has been submitted what's the best way 
to lock the data away securly? The script is being executed by 
NOBODY so any permission changes can be undone by NOBODY.


Thanks.
Scott Card
Microsolutions


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

Date: Sat, 9 Aug 1997 13:40:41 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Is there a perl IDE?
Message-Id: <EEnFBt.M7v@world.std.com>

Kenneth Vogt <KenVogt@rkymtnhi.com> writes:

>I can't seem to find a perl IDE for Win95 anywhere.  What do you folks
>use?  Is perl not worthy of anything more robust that Notepad?

First, one thing to keep in mind. The IDE concept was popularized
predominately by systems that did not have multitasking. The
edit-compile-find_error and edit-compile-debug-crash cycles were much
easier when you did not have to start and quit the editor, compiler,
and debugger each time.

Unix was developed initially on multitasking systems. Features like
job control allow the user leave the editor active all the time, so
the perl interpreter as developed with same philosophy as most unix
tools. So far, most non-unix ports kept this unix tool
heritage. (Except for MacPerl, which has a built in text editor.)

Another thing to point out, is that even though Microsoft gave you a
text editor named "Notepad", it doesn't mean that is is the only
product you can use to edit text. The choice isn't "Notepad" or
"IDE". It is "Notepad" or "Any Other Text Editor", with a side note of
"does that other text editor offer an IDE."

Personally, I've found Notepad to be lacking in features to do much
editting in (still using the same DOS based editor that I'm
comfortable with.), but have found that with all I need to do is have
a command shell open in a second window for running and debugging.
-- 
Andrew Langmead


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

Date: 5 Aug 1997 20:38:02 -0400
From: >?F<@jumbo.com
Subject: MS-DOS port of the Perl programming language
Message-Id: <5s8h1a$qs3@orion.jumbo.com>

Get NEW MS-DOS port of the Perl programming language Shareware As It's Written!

The latest and greatest MS-DOS port of the Perl programming language shareware and 
freeware as soon as it's created!   We download new programs DAILY 
(10 a.m. EST) from more than 300 sites all over the world.  

Check out the new programs everyday in the "TODAY'S FREE COMPUTER
PROGRAMS" section on the all new JUMBO! ---  bigger and faster 
than ever with over 200,000 files and programs --- more than 1.8 million 
links --- including a HUGE multimedia section with sounds, graphics, videos,
streaming music, VRML, animations, clip art, icons,
schockwave, screen savers --everything! --- http://www.jumbo.com.

Get the latest at:


http://www.jumbo.com/pages/programming/dos/perl/
http://www.jumbo.com/pages/programming/mac/languages/



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

Date: Sat, 9 Aug 1997 14:14:00 +0100
From: Jerry Pank <jerryp.usenet@SPAMconnected.demon.co.uk>
Subject: Newbie - Perl for Win
Message-Id: <0al9xBAY0G7zEwK7@connected.demon.co.uk>

I have installed perl for win and I am trying to work my way thru
examples in the llama book.

Whilst I can see that unix side will fail (as I have no unix directory
structure etc) I can get simple scripts to run ,in a dos window, but the
problem I have is that the window closes as soon as the script has
executed.  this gives me no time to evaluate my experiments.

Where am I going wrong - FAQs to read - Tutorials??

Thanks for your time...
-- 
This post in every-way totally reflects the views of my employer...
I am he.

Jerry           jerryp dot usenet at connected dot demon dot co dot uk

Warning - Wash out the spam filter first.


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

Date: Fri, 8 Aug 1997 08:23:37 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Barry Andre <bandre@xs4all.nl>
Subject: Re: Perl and Windows NT
Message-Id: <Pine.GSO.3.96.970808082221.9049N-100000@kelly.teleport.com>

On 8 Aug 1997, Barry Andre wrote:

> I want to implement CGI-Scripts for receiving forms in webpages on my
> webserver.
> 
> But I do not know how to do this.

If it's not explained in the documentation for your server, get a better
server. :-)  But if you have more questions about your server, you can get
better and more complete answers in a newsgroup about servers. Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 08 Aug 1997 16:33:23 +0300
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: printf
Message-Id: <33EB2023.251F@icl.fi>

denis@mathi.uni-heidelberg.de wrote:
> 
> hi all,
> 
> i've tryed to format the output of my perl script with printf.
> but printf writes the output on the right end of the field.
> how can i change this.

I don't understand what you mean (and I suspect others
don't either).

Could you post an example of your code and data, and
also try to depict the effect (what you see), and what
you expected to happen?

regards,
 ...petri.backstrom@icl.fi
    ICL Data Oy
    Finland


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

Date: Sat, 09 Aug 1997 09:51:24 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Problem installing 5.004_02 on MkLinux / Dynamic Loading
Message-Id: <pudge-ya02408000R0908970951240001@news.idt.net>

MkLinux2.1,update4 (2.0.30-osfmach3)

Everything runs perfectly through the config/make process, but I get the
following error on testing of all dynamically loaded modules:

   undefined symbol: Perl_markstack_ptr at ../lib/DynaLoader.pm line 155.

Now, if I can't figure it out, I can always compile for static loading, but
I'd rather not.  Any ideas?

Thanks,

--
Chris Nandor             pudge@pobox.com             http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])


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

Date: Tue, 05 Aug 1997 09:30:48 -0400
From: Dan Boorstein <dboorstein@ixl.com>
To: "J.Hernetkoski" <jjjj@zenith.yok.utu.fi>
Subject: Re: Regexp
Message-Id: <33E72B08.B7458733@ixl.com>

i think this should work:

s,href="/?([^"]+),href="http://my.server.com/$1,g;

you only need to capture the path and filename.
if all your cases have leading slashes then you could remove
the '/?' from the search string and the '/' before the $1
from the replacement string.

cheers,

dan boorstein

J.Hernetkoski wrote:
> 
> How would I change all lines that contains
> 
> <a href="/something.html">
> 
> to
> 
> <a href="http://my.server.com/something.html"> ?
> 
[snip]
> 
> I tried this:
> 
> foreach (@results) { # @results contains an html-page
> 
>         s/(<A HREF=\".*\">)/<A HREF=\"http:\/\/my.server.com\/$1\">/g;
> 
> }
>


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

Date: Tue, 05 Aug 1997 23:26:02 +0300
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: Running Perl under Windows - No NFS
Message-Id: <33E78C5A.1D65@icl.fi>

Jerry Pank wrote:
> 
> Newbie question, ploughed thru loads of FAQs - Still confused!
> 
> In order to get to speed quickly I need to be able to test my scripts -
> initially more for simple sytax checking than anything else - locally on
> a PC (W95 pref) before FTPing/testing/failing_for_stupid_reasons !

Well, install Perl on your Windows 95 system (Windows NT preferred -
over Windows 95, that is; otherwise it is a personal choice ;-)

Start with locations such as:

  http://www.perl.com/perl/
  http://www.activeware.com
 
> Whilst I don't expect the cgi stuff to run I guess there must be some
> form of emulator about.

You should (expect CGI stuff to run); if you install a web 
server on your machine, you can test all aspects of your C
GI scripts that do not have UNIX or other O/S dependencies.

And if you use CGI.pm in your scripts, it'll help you test
CGI functionality from the command line without a web
server:

  http://www-genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.htm

Search WWW-related newsgroups for web servers for your
environment. Use services such as

  http://www.dejanews.com
  http://altavista.digital.com

to assist you.

>                          Everything I can find from CPAN assumes (I
> think) that the system will be /live/ or running as a NFS.

What makes you think that? Where did you get the NFS part?

FWIW, there are NFS client implementations also for Windows 95,
should you need such a beast (or install SAMBA on the targer
server and use Windows' built-in networking facilities).
 

regards,
 ...petri.backstrom@icl.fi
    ICL Data Oy
    Finland


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

Date: Sat, 9 Aug 1997 10:33:51 -0400
From: Anagrams of the Word  <jefpin@bergen.org>
To: Tony Cox <a.cox@rbgkew.org.uk>
Subject: Re: Searching for "similar" words
Message-Id: <Pine.SGI.3.95.970809102244.2536A-100000@vangogh.bergen.org>

>However, I'd also like to return "similar" word in case they have misspelled
>the word - that way I can present a list of all possible/likely database
>records. Is there a way of doing this with Perl other than searching using
>regexs that represent many varieties of substrings of the keyword?

Tell you what... I have an idea... I'll work on it and let you know!


----------------
| "I am NOT a mother!"
| 	- Jennifer Pinyan
----------------
Jeff "TechMaster" Pinyan | http://users.bergen.org/~jefpin
I do: HTML!! CGI!! Perl!! JavaScript!! jefpin@bergen.org
Got a JavaScript/CGI/Perl question or problem?  Let me know!

webXS - the new eZine for WebProgrammers! TechMaster@bergen.org
Visit us @ http://users.bergen.org/~jefpin/webXS



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

Date: Sat, 9 Aug 1997 13:44:59 -0400
From: Anagrams of the Word  <jefpin@bergen.org>
To: Tony Cox <a.cox@rbgkew.org.uk>
Subject: Re: Searching for "similar" words
Message-Id: <Pine.SGI.3.95.970809134226.3984A-100000@vangogh.bergen.org>

>>However, I'd also like to return "similar" word in case they have misspelled
>>the word - that way I can present a list of all possible/likely database
>>records. Is there a way of doing this with Perl other than searching using
>>regexs that represent many varieties of substrings of the keyword?

>Tell you what... I have an idea... I'll work on it and let you know!

I do not lie... here it is:

--- script ---

#!/usr/bin/perl

@keyword = (		# setting keywords searched for
	wierd,
	don
);

$list = "weird,done,den";	# setting list of words to be checked
$hit = 0;

foreach $kw (@keyword){
	$len = length($kw);
	for ($x = 0; $x < $len; $x++){	# changing one letter
		$y = $x + 1;
		$a = substr($kw,0,$x);
		$b = substr($kw,$y,$len-$y);
		$hit{$kw}++ if $list =~ /\b$a\w$b\b/i;
	}
	for ($x = 0; $x <= $len; $x++){	# adding one letter
		$a = substr($kw,0,$x);
		$b = substr($kw,$x,$len-$x);
		$hit{$kw}++ if $list =~ /\b$a\w$b\b/i;
	}
	for ($x = 0; $x < $len-1; $x++){	# transposing two letters
		$y = $x + 2;
		$a = substr($kw,0,$x);
		$b = substr($kw,$x,1);
		$c = substr($kw,$x+1,1);
		$d = substr($kw,$y,$len-$y);
		$hit{$kw}++ if $list =~ /\b$a$c$b$d\b/i;
	}
}

foreach $word (sort numerically keys %hit){
	print "$word - $hit{$word} hits\n";
}

sub numerically {
$hit{$b} <=> $hit{$a};
}

--- end ---

Let me know if it works for you!


----------------
| "Shooting is NOT too good for my enemies!"
| 	- "The Overlord List"
----------------
Jeff "TechMaster" Pinyan | http://users.bergen.org/~jefpin
I do: HTML!! CGI!! Perl!! JavaScript!! jefpin@bergen.org
Got a JavaScript/CGI/Perl question or problem?  Let me know!

webXS - the new eZine for WebProgrammers! TechMaster@bergen.org
Visit us @ http://users.bergen.org/~jefpin/webXS



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

Date: Sat, 09 Aug 1997 10:25:10 -0400
From: "Joseph H. Buehler" <jhpb@sarto.gaithersburg.md.us>
Subject: snobol5-like parser for PERL?
Message-Id: <33EC7DC6.678DBCAD@sarto.gaithersburg.md.us>

Regular expressions are nice, but they have their limitations.
Has anyone considered doing a parser for PERL something like the one
in the old SNOBOL 5 language?

Joe Buehler


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

Date: 9 Aug 97 18:27:03 GMT
From: "Alex Lane" <alexlane@ghg.net>
Subject: Strange shebang behavior in linux
Message-Id: <01bca4fa$3a8e12e0$a26e42ce@zaika>

I recently brought a Linux box into existence and am having a problem with
perl scripts that use #!/usr/bin/perl to call the perl interpreter.
1. I've made sure the path to the perl interpreter is indeed /usr/bin/perl
2. The scripts have been made executable.
3. One script, which prints "Howdy, world!" works perfectly.
4. A second script, which does something more complex, elicits an error
message from the Bourne Again Shell, to the effect that "No such file or
directory"

Does anyone have any idea what I am doing wrong? Thanks in advance.
Cheers... 
alexlane@ghg.net       ...speaking only for myself
Seabrook, Texas        http://www.ghg.net/alexlane
PGP fingerprint: 7FDB06E2478479B4 323CA94865AA5BC2
"No plan survives initial contact with the enemy." -- Von Moltke
"...but without a plan, *you* will not survive." -- Lane



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

Date: Sat, 09 Aug 1997 16:03:10 +0200
From: "Roman Blvth" <R.Bloeth@ping.de>
Subject: URGENT! Help needed!!
Message-Id: <33EC789D.6F207E70@ping.de>

Hi folks!

This one is very urgent: I want to run a perl script which uses (via
use) IO::Socket and IO::Select. But with both of these perl exits the
compiling process saying: Can't locate IO/Socket (resp. IO/Select) in
@INC

What can I do?! There is no directory under /usr/lib/perl5 like IO, but
I don't even think it should. I fetched the newest perl 5.004 (before it
was 5.002) and didn't get the problem solved either.

I'm just a perl beginner and perhaps this problem is pretty silly, so
forgive me but please help me if you can, I'm praying...

Best regards, Roman.



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

Date: Sat, 09 Aug 1997 16:07:03 +0200
From: "Roman Blvth" <R.Bloeth@ping.de>
Subject: Re: URGENT! Help needed!!
Message-Id: <33EC7987.BA7701@ping.de>

Roman Blvth schrieb:

> Hi folks!
>
> This one is very urgent: I want to run a perl script which uses (via
> use) IO::Socket and IO::Select. But with both of these perl exits the
> compiling process saying: Can't locate IO/Socket (resp. IO/Select) in
> @INC
>
> What can I do?! There is no directory under /usr/lib/perl5 like IO,
> but
> I don't even think it should. I fetched the newest perl 5.004 (before
> it
> was 5.002) and didn't get the problem solved either.
>
> I'm just a perl beginner and perhaps this problem is pretty silly, so
> forgive me but please help me if you can, I'm praying...
>
> Best regards, Roman.

   I forgot to remark that other modules are properly found by perl,
such as when I add "use DB_File" to the program. So the PERL5LIB seems
to be set alright.



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

Date: 9 Aug 1997 15:07:16 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: URGENT! Help needed!!
Message-Id: <5si134$ls3@news-central.tiac.net>

In article <33EC7987.BA7701@ping.de>, Roman Blvth <R.Bloeth@ping.de> wrote:
>> This one is very urgent: I want to run a perl script which uses (via
>> use) IO::Socket and IO::Select. But with both of these perl exits the
>> compiling process saying: Can't locate IO/Socket (resp. IO/Select) in
>> @INC
>>
>> What can I do?! There is no directory under /usr/lib/perl5 like IO,
>> but
>> I don't even think it should. I fetched the newest perl 5.004 (before
>> it
>> was 5.002) and didn't get the problem solved either.
>>
>> I'm just a perl beginner and perhaps this problem is pretty silly, so
>> forgive me but please help me if you can, I'm praying...
>>
>> Best regards, Roman.
>
>   I forgot to remark that other modules are properly found by perl,
>such as when I add "use DB_File" to the program. So the PERL5LIB seems
>to be set alright.

Are you actually running the newly installed perl, check that it's the
correct version by running

  perl -v

or from your shell prompt

  which perl

will teyy you which executable you're picking up.  If you're getting 5.004
then 

  perl -V

should dump its configuration state to your terminal and it ends with
something like:

Characteristics of this binary (from libperl): 
  Built under linux
  Compiled at Aug  8 1997 10:46:26
  @INC:
    /usr/local/lib/perl5/i586-linux/5.00402
    /usr/local/lib/perl5
    /usr/local/lib/perl5/site_perl/i586-linux
    /usr/local/lib/perl5/site_perl
    .

On my system I find Socket and Seekable in .../perl5/i586-linux/5.00402:

$ ls /usr/local/lib/perl5/i586-linux/5.00402/IO
File.pm      Handle.pm    Pipe.pm      Seekable.pm  Select.pm    Socket.pm

If the modules are there and readable then you should post the exact error
message and where the IO library is installed on your machine.

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

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

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