[7563] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1189 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 17 08:17:17 1997

Date: Fri, 17 Oct 97 05:00:40 -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           Fri, 17 Oct 1997     Volume: 8 Number: 1189

Today's topics:
     Re: 2000 time problem (Steffen Beyer)
     Re: 2000 time problem (Mike Heins)
     Re: ARGV question (Nem W Schlecht)
     Re: ARGV question <hfr@metzler.com>
     Re: Bi-directional Socket Clients? <seay@absyss.fr>
     CGI-Perl Programmer wanted <jim01@deltanet.com>
     Clear end of line: how <jll@skynet.be>
     RE: Cookies <tborn@chev.com.au>
     Re: Cookies (Jeremy D. Zawodny)
     Re: File creation in macPerl (John Moreno)
     Re: file manipulation question (Nem W Schlecht)
     Re: Global Search and Replace Question <crn@bby.com.au>
     Need help on NT (Dolven Chan)
     Re: Perl and SQL? <boei@trifox.com>
     Re: Perl and SQL? <kevinl@ascend.com>
     Re: Q: Perl upload protocols (Jeremy D. Zawodny)
     Re: Recursive pattern replacement - help (Keith Willis)
     Socket problem in Perl!!!!!!!!!!! <savy@public3.bta.net.cn>
     Re: Socket problem in Perl!!!!!!!!!!! (Jeremy D. Zawodny)
     Re: String manipulation in Perl (Jim Buchanan)
     Re: String manipulation in Perl (Casper K. Clausen)
     Re: String manipulation in Perl <seay@absyss.fr>
     Re: Web Programmer Wanted (Ook!)
     Re: Win32, problem opening dir (Hans Schrader)
     wwwboard.pl <mickael@adarweb.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 17 Oct 1997 09:48:29 GMT
From: sb@en.muc.de (Steffen Beyer)
Subject: Re: 2000 time problem
Message-Id: <627c9d$e3e$1@en1.engelschall.com>

Petri Backstrom <petri.backstrom@icl.fi> wrote:

> Now, if I'd venture a guess, you will not be using Windows 95
> or the current release of Perl in 2038 (less in 2050), and I'm 
> sure that long before 2038 you'll have a computer where this 
> won't be a problem (in the Perl current then or anything else).

That's exactly what the argument was back in the fifties or so when
the assembler and COBOL code was created that is going to break in
2000...

Yours,
-- 
    Steffen Beyer <sb@sdm.de> http://www.engelschall.com/u/sb/
     "There is enough for the need of everyone in this world,
      but not for the greed of everyone." - Mahatma Gandhi
   >> Unsolicited commercial email goes directly to /dev/null <<


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

Date: 17 Oct 1997 11:06:31 GMT
From: mheins@prairienet.org (Mike Heins)
Subject: Re: 2000 time problem
Message-Id: <627grn$k2o$1@vixen.cso.uiuc.edu>

Steffen Beyer (sb@en.muc.de) wrote:
: Petri Backstrom <petri.backstrom@icl.fi> wrote:
: 
: > Now, if I'd venture a guess, you will not be using Windows 95
: > or the current release of Perl in 2038 (less in 2050), and I'm 
: > sure that long before 2038 you'll have a computer where this 
: > won't be a problem (in the Perl current then or anything else).
: 
: That's exactly what the argument was back in the fifties or so when
: the assembler and COBOL code was created that is going to break in
: 2000...

The difference was that their decision one was code-related, and could
not be saved by a doubling of integer size. It is guaranteed that 
even Windows will be 64-bit by then...

-- 
Regards,
Mike Heins

This post reflects the
opinion of my employer.


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

Date: 17 Oct 1997 02:59:25 -0500
From: nem@abattoir.cc.ndsu.nodak.edu (Nem W Schlecht)
Subject: Re: ARGV question
Message-Id: <6275st$k8q@abattoir.cc.ndsu.nodak.edu>

[courtesy copy e-mailed to author(s)]

In comp.lang.perl.misc, Alan  <ahecker@interport.net> wrote:
>
>So, if I do:
>
>$count = 1;
>$len = @ARGV;
>until ($count == $len) {
>      open (IN, $ARGV[$count]);
>      #do some operations here
>      close (IN);
>      $count++;
>}
>
>Should the open statement work correctly or not? And if not, 1) what
>will make it work the way I need it to--namely, opening the args from
>the command line, in order--and 2) why doesn't mine work?
>
>Sorry if this is bonehead, dirt simply stuff, but hey, I've been doing
>this a whole 2 weeks now! :-)

This is a pretty good start for only 2 weeks worth of work - it works fine
on my machine - I just added 'print "opened $ARGV[$count]\n";' where the
'do some op..' is at.  Although, you do have some bad coding styles. (I'm
condradicting one of beliefs, though.  One of "Larry Wall's Rules of Perl"
paraphrased - "If it gets the job done, it's good perl.")

Here are a couple versions of what you want, with a line-by-line
explaination:

Simple/Long version:
--------------------------------------------------------------------
use IO::File;		# using this for file IO is a little bit nicer
$count = 1;
$len = scalar @ARGV;	# using '$len = @ARGV' is bad, because if @ARGV
			# contains only one element, $len will be set to
			# that instead of '1'
until($count == $len) {
    $cur_line = new IO::File;	# create new 'IO::File' object
    $cur_line->open("$ARGV[$count]") || die "Couldn't open $ARGV[$count]";
	# a failed open() is usually the problem in a lot of bad scripts
    print "Opened $ARGV[$count]\n";
    $cur_line->close();		# close the prev. file
    $count++;			# increment count
}
--------------------------------------------------------------------

A little bit shorter:
$count and $len are useless.  You can just use 'for (@ARGV)' instead
--------------------------------------------------------------------
use IO::File;

for (@ARGV) {			# iterate over command line arguments
    $file = $_;	    # assign magic variable '$_' - current element in for()
		    #   loop to $file
    $cur_line = new IO::File;	# create new 'IO::File' object
    $cur_line->open("$file") || die "Couldn't open $ARGV[$count]";
	# a failed open() is usually the problem in a lot of bad scripts
    print "Opened $file\n";	# obvious
    $cur_line->close();		# close the prev. file
}
--------------------------------------------------------------------

Of course, removing comments and changing to small variable names can
shorten it even more:

One line (non-OO) version:
perl -e 'for(@ARGV){open(F,"$_");print"Opened $_\n";close(F)}' *

Longer, OO version:
perl -MIO::File -e 'for(@ARGV){$n=new IO::File;$n->open("$_");
  print"Opened $_\n";undef($n)}' *

-- 
Nem W Schlecht                  nem@plains.nodak.edu
NDUS UNIX SysAdmin         http://www.nodak.edu/~nem
"Perl did the magic.  I just waved the wand."


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

Date: Fri, 17 Oct 1997 13:48:58 +0200
From: "H. Fellinghauer" <hfr@metzler.com>
Subject: Re: ARGV question
Message-Id: <344750AA.1B84@metzler.com>

Alan wrote:
[snip]
> 
> $count = 1;
> $len = @ARGV;
> until ($count == $len) {
>       open (IN, $ARGV[$count]);
>       #do some operations here
>       close (IN);
>       $count++;
> }
>
[snip]
You do not start processing the command line arguments at the very first
argument (the argument counter starts at zero)!

Furthermore, you should check for the result of the open() function like
  open(IN,$ARGV[$count]) || warn "Can't open $ARGV[$count}: $!";

Be sure not to continue processing for files that can't be opened:
  if (open(IN,$ARGV[$count])) {
    #do some operations here
    close(IN);
  }
  $count++;

HTH.
  Harry

-- 
                                                      ///
  Hiroshima '45   Chernobyl '86   Windows '95        (O O)
-------------------------------------------------oOO--(_)--OOo---------
  "There is more than one way to do it!"


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

Date: Fri, 17 Oct 1997 10:51:52 +0200
From: Doug Seay <seay@absyss.fr>
To: Mark Nottingham <mnot@pobox.com>
Subject: Re: Bi-directional Socket Clients?
Message-Id: <34472728.18862F37@absyss.fr>

[posted and mailed]

Mark Nottingham wrote:
> 
> Simple question (I hope). I'm following the cookbook examples in the
> perlipc pages to put together a unix-domain socket client/server; I need to
> talk bi-directionally. It's easy in the server side, as STDIN and STDOUT
> are both connected up for me, but what about in the client? Is there a way
> to get separate handles with connect()?
> 
> I can read or write to the SOCK handle as in the cookbook, but I'd like to
> do both. I haven't tried resetting the filepointer or anything like that,
> as it SEEMS there should be a better way to do it...

sockets are bidrectional, so a simple echo server would do something
like

	my $data = <SOCKET>;
	print SOCKET $data;

No need for independant sockets.  If you really want two file handles
(Perl construct) for the same socket (OS construct), you can play funny
games with open() using the >& type notation.  I don't see what that
would buy you, but it could be done

- doug


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

Date: 17 Oct 1997 07:11:54 GMT
From: "Jim Kuykendall" <jim01@deltanet.com>
Subject: CGI-Perl Programmer wanted
Message-Id: <01bcdacb$e93656c0$1bbfabc7@nec>

I would like to hire a CGI-Perl Programmer to automate my web site on a
contract basis.    The programming will require changing graphics based on
system date AND users use of forward and backward navigational buttons. 
The site is currently running on a NT platform.  Please email me if you are
interested.  I will then forward you all the information you may require to
formulate your contract bid.

Thanks,
Jim Kuykendall


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

Date: Fri, 17 Oct 1997 11:06:26 +0200
From: Jean-Louis Leroy <jll@skynet.be>
Subject: Clear end of line: how
Message-Id: <VA.00000029.02623b29@jll_p133.INFOCAHB>

Hello,

how can I clear the end of the line in a console (aka terminal) window 
with perl-win32 under NT? If there's a portable way it's even better. 
TIA.

Jean-Louis Leroy
http://ourworld.compuserve.com/homepages/jl_leroy



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

Date: 17 Oct 1997 08:44:49 GMT
From: "Chevron" <tborn@chev.com.au>
Subject: RE: Cookies
Message-Id: <01bcdad8$b6ab6c10$505aa8c0@ntserver>


-- Can anyone tell me what are the tags for cookies in iis(NT4)
****************************************
Chevron Computer Consultants
410 Murray Street
Perth; WA 6100

email: gkelly@xlane.net.au


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

Date: Fri, 17 Oct 1997 11:44:00 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Cookies
Message-Id: <34484f46.324023280@igate.hst.moc.com>

[cc'd automagically to original author]

On 17 Oct 1997 08:44:49 GMT, "Chevron" <tborn@chev.com.au> wrote:

>
>-- Can anyone tell me what are the tags for cookies in iis(NT4)

Please post this to one of the web server newsgroups. You're obviously
not asking a Perl question--either that, or you're trying to hide the
Perl part of your question from us.

If you have a specific Perl question, we'd be glad to answer.

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: Fri, 17 Oct 1997 03:11:04 -0400
From: phenix@interpath.com (John Moreno)
Subject: Re: File creation in macPerl
Message-Id: <19971017031104144475@roxboro-190.interpath.net>

Chris Braiotta <chris_braiotta@harvard.edu> wrote:

] I'm sure this question has been answered a million times, but I've
] found nothing in dejanews or any of the macPerl faq's. I have two
] questions, and any help at all (including pointers to documentation)
] would be greatly appreciated.
] 
] How does one
]     a) create folders in macperl
]     b) write files to specific folders
] 
] This is all quite easy in UNIX based perl, but I'm at a loss in
] macPerl.

I'm not sure what your problem is, just use the same commands that you
would use under unix namely mkdir and chdir.  The only difference is
that if you are dealing with files/folders at a different level than the
current default then you have to remember that the character that
denotes a directory is not a slash (/) but is instead a colon (:).

Thus to create a directory called jest at current location use:
mkdir("jest),0x0);

Then to work in that directory you have to use either ":jest:filename"
as the file name or chdir ":jest:"; then just use "filename".

-- 
John Moreno


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

Date: 17 Oct 1997 02:21:59 -0500
From: nem@abattoir.cc.ndsu.nodak.edu (Nem W Schlecht)
Subject: Re: file manipulation question
Message-Id: <6273mn$k0m@abattoir.cc.ndsu.nodak.edu>

[courtesy copy e-mailed to author(s)]

In comp.lang.perl.misc, Steven Duffy <sduffy@dreamscape.com> wrote:
>Hello,
>I have been trying to find an easy way to do this for quite a while now.  I
>am trying to write a Perl script in which a user can change their data in
>the password file such as their shell and their real name.  This is going
>very well except for one thing. I am having a lot of trouble overwriting
>the old line in the password file with the new one.  Does any one know of
>an easy way to do this.  The substitution of the old and new line is no
>problem and the script works fine when it has to change root's line

Hmm.. this is rather dangerous on a multi-user machine.  I take it if you
are doing this that you do *not* have the 'chfn' (CHange Finger Name) and
'chsh' (CHange SHell) programs?  (There is source available on the net if
you don't) IMO, it would probably be better to use 'expect' and call 'chfn'
and 'chsh' - or teach your users to user 'chfn' and 'chsh'. If you have a
large number of users and a hashed password dbm file, you'll want to *not*
touch /etc/passwd anyways (unless, of course, you updated the hashed file
yourself.)

-- 
Nem W Schlecht                  nem@plains.nodak.edu
NDUS UNIX SysAdmin         http://www.nodak.edu/~nem
"Perl did the magic.  I just waved the wand."


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

Date: 17 Oct 1997 16:14:15 +1000
From: Clive Newall <crn@bby.com.au>
Subject: Re: Global Search and Replace Question
Message-Id: <v5hgag9ars.fsf@nellie.bby.com.au>

In article <34468c5b.9652684@news.peterboro.net> killbell@peterboro.net (Drake Cleary) writes:

   >In article <34465a4a.12102284@news.peterboro.net>,
   >Drake Cleary <killbell@peterboro.net> wrote:
   >>I'm trying to do a search and replace for my whole web site with the
   >>following....
   >>
   >>perl -p0777i -e 's/ - \d Home Pages/\<\!-- 0 --\>/gm;' `find . -name
   >>'*.html' -print`
   >>

I'll assume you have worked out why this wasn't working.
 ...
   >
   >If you're getting something like  ``arg list too long'', try this
   >
   >	perl -p0777i -e 'BEGIN { @ARGV=`find . -name "*.html" -print` }' \
   >		     -e 's/ - \d Home Pages/\<\!-- 0 --\>/gm;'
   >John.

   The arg list too long error is replaced by FILE NAME TOO LONG error!
   Is there any way around that?

   Thanks, by the way!

1. Use "-w" !
2. The "-0777" means use octal 777 as the record separator. (RTFM: perlrun)
	So...you end up with exactly *1* filename, which just happens
	to be "file1\nfile2\nfile3\n....."
3. There is almost certainly a perl module in CPAN that could replace
   the call to "find".


crn






-- 
Clive Newall <crn@bby.com.au> / Broker Services Australia Ltd Melb Australia
"I think Casper is the ghost of Richie Rich. I wonder how Richie died?"
"Perhaps he realized how hollow the pursuit of money is and took his own life"
  --Bart and Lisa Simpson


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

Date: Fri, 17 Oct 1997 12:35:38 +0800
From: dolven@fairhost.com (Dolven Chan)
Subject: Need help on NT
Message-Id: <dolven-1710971235390001@yckam025047.netvigator.com>

Dear fellows,
   I have tried to install Perl32 to run my scripts on my NT4.0 server. I
used IIS3.0 as the WWW. Would anyone please tell me how to make the
scripts work?

1. Installed Perl Win32 on my DOS path.
2. Autoinstall the PerlIS on IIS (add .pl ext.)
3. I use regedt32 edit the 
   HK_LOCAL_MACHINE\SYSTEM\CURRENTCONTROLSET\SERVICES\W3SVC\PARAMETER\SCRIPT_MAP
   I ADD [.CGI] VALUE TO REG_SZ WITH STRING TO THE FULL PATH OF MY PERL.EXE
   [C:\PERL\BIN\PERL.EXE %1 %*]
4. RESTART

I have checked my directory permissions and allow IUSER to use. 
Did I do any thing wrong? Please help..

Thank You very much


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

Date: Thu, 16 Oct 1997 09:33:01 -0700
From: Bob Eisner <boei@trifox.com>
To: Henry Hartley <hartleh1@westat.com>
Subject: Re: Perl and SQL?
Message-Id: <344641BD.470B@trifox.com>

Henry Hartley wrote:
> 
> I am relatively new to Perl but wanted to write some scripts to lookup,
> modify, etc. records in an SQL database.  I've managed to write a script
> that will add records to the database but I'm not really sure about
> getting data back out.  I've been searching for anything documenting
> this (SQL in Perl) but can't seem to find much.  Any pointers, URLs or
> other resources (online or not) would be appreciated.
> 
> Henry Hartley
> Westat

Hi Henry,

Have a look at VORTEXperl from Trifox.

VORTEXPerl provides a simple interface for Perl applications to
access all leading relational and legacy databases via the
VORTEX database access and performance boosters, like
VORTEXaccelerator, the industry-leading high performance
transaction process monitor. With VORTEXPerl you can quickly
access DBMS information from CGI applications and spend your
time making your application great without bothering with DBMS
details. 

VORTEXPerl reads and writes data directly to and from TCP/IP
socket stream protocols which: 
 
-  Eliminates the need for any development work on the client
   side. 

-  Provides the best possible security and ensures compatibility
   with any Perl client. 

Servers that are currently supported include: 

       Windows NT             Unix
       OS/2                   OpenVMS
                              MVS

VORTEXPerl minimizes network traffic thereby improving
performance, with the following advanced features: 

-  Cursor caching -- Client side cursors are automatically
   cached, reducing actual interactions between the Perl client and
   the RDBMS server. 

-  Bulk operations -- SELECT, INSERT, UPDATE, and
   DELETE requests operate on multiple records in a single network
   transaction. 

You can obtain an evaluation copy of VORTEXperl and VORTEXserver
from our WEB site at http://www.trifox.com/vortex/vtxperl.html

Regards,

Bob Eisner
408 369-2392


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

Date: 17 Oct 1997 07:35:01 -0400
From: Kevin Lambright <kevinl@ascend.com>
Subject: Re: Perl and SQL?
Message-Id: <yhfyb3swrkq.fsf@ascend.com>

Bob Eisner <boei@trifox.com> writes:

> 
> Henry Hartley wrote:
> > 
> > I am relatively new to Perl but wanted to write some scripts to lookup,
> > modify, etc. records in an SQL database.  I've managed to write a script
> > that will add records to the database but I'm not really sure about
> > getting data back out.  I've been searching for anything documenting
> > this (SQL in Perl) but can't seem to find much.  Any pointers, URLs or
> > other resources (online or not) would be appreciated.
> > 
> > Henry Hartley
> > Westat
> 
> Hi Henry,
> 
> Have a look at VORTEXperl from Trifox.

Henry,

Also take a look at the DBI and DBD modules, which can help you write
database independant code.  You did not say what database or platform
you are using, but more than likely, there is a DBD module for the
database you are using.  Both DBI and the corresponding DBD modules
can be found at your local CPAN mirror.  Also, check out the following
for some more information on DBI/DBD:

	http://www.hermetica.com/technologia/perl/DBI

Hope this helps,

Kevin
-- 
------------------------------------------------------------------------------
Kevin Lambright                                    email: kevinl@casc.com
Ascend Communications                              voice: 978-952-7407
1 Robbins Road                                     fax:   978-692-1510
Westford, MA 01886


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

Date: Fri, 17 Oct 1997 11:42:36 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Q: Perl upload protocols
Message-Id: <34474ed0.323904960@igate.hst.moc.com>

[cc'd automagically to original author]

On Fri, 17 Oct 1997 05:40:24 GMT, daryn@solamnia.demon.co.uk (Daryn
Brightblade) wrote:

>Hey there..
>I'm a newbie here so if I tread on any toes, I apologize..
>I have a problem
>I'm trying to upload a text file (fairly large) through perl into an
>NT server directory
>I've got perl running on the NT server and now i just need to upload a
>text file thru the perl script into a temporary directory on the
>server..
>I've tried several scripts but they don't work completely..

I'm a bit unsure as to what you mean about uploading "through" Perl.
Do you have some sort of custom upload server written in Perl which
runs there? If so, what sorts of error messages are you seeing?

You've said your scripts don't work "completely"... Do you mean that
they completely don't work, or that they bomb part way through?

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: Fri, 17 Oct 1997 08:44:08 GMT
From: keith_willis.junk@non-hp-unitedkingdom-om1.om.hp.com (Keith Willis)
Subject: Re: Recursive pattern replacement - help
Message-Id: <3449226e.600436512@news>

On Mon, 13 Oct 1997 12:44:49 -0500, tadmc@flash.net (Tad McClellan)
wrote:

>Donna Smith CT90 (d1smith@gmr.com) wrote:
>: where filelist is a file containing a list of all the html
>: files in this directory tree.  This works fine on a short list but the system can't handle an input list of files this big and I get: 
>
>: Argument list too long
>
>That is a message from the shell, not from perl.
>
>Possible solutions:

How about (on one line):

find /top_of_tree -name '*.html' -exec perl -pi.bak -e 's#<center><a
href="/htbin...#new string#' {} \;

Rather than the shell throwing all the names at perl, it will invoke
perl once per name found.  Slower, but it should work.
----------------------------------------------------------------------
The above message reflects my own views, not those of Hewlett Packard.
When emailing me, please note that there is no '.junk' in my address.


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

Date: Fri, 17 Oct 1997 17:48:24 +0800
From: David Wu <savy@public3.bta.net.cn>
Subject: Socket problem in Perl!!!!!!!!!!!
Message-Id: <34473468.430084AA@public3.bta.net.cn>

I'm a newbie of Socket program by Perl. I want to develop the socket
application by Perl.  For example: Send a mail to the SMTP server. I use
Windows95&WindowsNT 4.0, Perl 5.01. How can Perl do this? Thanks for any
help you can give me. The source code is preferred.

Euphie Zhou



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

Date: Fri, 17 Oct 1997 11:45:34 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Socket problem in Perl!!!!!!!!!!!
Message-Id: <34494f96.324102965@igate.hst.moc.com>

[cc'd automagically to original author]

On Fri, 17 Oct 1997 17:48:24 +0800, David Wu <savy@public3.bta.net.cn>
wrote:

>I'm a newbie of Socket program by Perl. I want to develop the socket
>application by Perl.  For example: Send a mail to the SMTP server. I use
>Windows95&WindowsNT 4.0, Perl 5.01. How can Perl do this? Thanks for any
>help you can give me. The source code is preferred.

Oooh. I'd suggested upgrading to a newer version of Perl. Some older
distributions on the Win32 platform had socket problems. You're
certain to get better support if you're using an up-to-date
distribution.

See http://www.perl.com/ for sources.

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: 15 Oct 1997 20:22:12 GMT
From: c22jrb@dawg.delcoelect.com (Jim Buchanan)
Subject: Re: String manipulation in Perl
Message-Id: <6238lk$9b8$1@kocrsv08.delcoelect.com>

John Goerzen (jgoerzen+usenet@complete.org) wrote:
:   string[3] = 'Q';
:
: I cannot seem to find an easy way to to this in Perl.  It appears that

If I understand what you want:

#!/bin/perl -w

$foo = "abcdefg";

print "$foo\n";

substr ($foo, 3, 1) = "Q";

print "$foo\n";



jbuchana$ ./foo.pl
abcdefg
abcQefg
jbuchana$



Jim Buchanan        c22jrb@dawg.delcoelect.com      jbuchana@earthcorp.com 
================== http://www.earthcorp.com/jbuchana =====================
"A fig for those by law protected! Liberty's a glorious feast!
 Courts for cowards were erected, Churches built to please the priest."
 -Robert Burns
==================== http://hybiss.delcoelect.com ========================


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

Date: 17 Oct 1997 10:25:49 +0200
From: ckc@dmi.min.dk (Casper K. Clausen)
Subject: Re: String manipulation in Perl
Message-Id: <wvpbu0ox0c2.fsf@hobbes.dmi.min.dk>

>>>>> "J" == John Goerzen <jgoerzen+usenet@complete.org> writes:

J> zawodny@hou.moc.com (Jeremy D. Zawodny) writes:

J> Also..  It is hard to specify a "range" of characters, excluding some
J> certain specific ones, with regexps (unless I am missing some regexp
J> feature).

As in /[^\x20-\x79]/ (any character not in the range 32-127) or
perhaps /[\x00-\x1F\x80-\xFF]/ (any character from 0-31 or 128-255)?

Regards,
Kvan.
-- 
-------Casper Kvan Clausen------ | 'Ah, Warmark, everything that passes
----------<ckc@dmi.dk>---------- |  unattempted is impossible.'
           Lokal  544            |   
I do not speak for DMI, just me. |        - Lord Mhoram, Son of Variol.      


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

Date: Fri, 17 Oct 1997 10:35:42 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: String manipulation in Perl
Message-Id: <3447235E.FEFC545@absyss.fr>

John Goerzen wrote:
> 
> Well, here's the project...  I am working on a printer filter.  I am
> trying to decide what language to use -- C or Perl.  I want to use
> Perl because I could use the experience if nothing else.
> 
> Basically, here's what I will start it out as: read from stdin, write
> to stdout.  Check to make sure that certain characters do not get
> through.  If one of these characters appears on stdin, abort
> processing and return an error code.
> 
> (ie, filter out most characters below 32 and above 127)

Try read() to grab fixed sized chunks (4k or 16k are often a good
values, but "best" values are system specific) and use tr///d to delete
offending characters.  Perhaps

	while ( ! eof(STDIN) )
		{
		read(STDIN, $buffer, 4096);
		# remove 0-31, 128-255
		$buffer =~ tr/\x00-\x1f\80-\xff//d;
		print $buffer;
		}

would be a good starting point.

> Also..  It is hard to specify a "range" of characters, excluding some
> certain specific ones, with regexps (unless I am missing some regexp
> feature).

Nope, I think you overlooked "-".  I use two ranges in my example above.

> I am slightly concerned about speed, iterating over 5 meg files with a
> regexp does not make me feel good, but this I will have to see about
> once I try out a Perl program like this for myself.

I'd guess that this would be kinda zippy, faster that what I'd throw
together in C.  The question isn't really the RE in memory, that isn't
(usually) a big deal.  I'm not sure, but I think that RE processing is
more or less linear with the size of the data (called O(n) if I remember
correctly).  The I/O is often more of a problem.  Pick a size of data
that corresponds to your file systems block size.

- doug


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

Date: Fri, 17 Oct 1997 02:19:45 -0700
From: OokOokOok@rocketmail.com (Ook!)
Subject: Re: Web Programmer Wanted
Message-Id: <OokOokOok-1710970219460001@dialup-b026.europa.com>

In article <tdm626.q9k.ln@localhost>, tadmc@flash.net (Tad McClellan) wrote:

<SNIP>
- 
-    As a clueful headhunter would not have done this, we then infer...
- 

Heck, you missed the worst offense, JavaScript hasn't been around for
three years.

His post should have ended with:

Ich suche eine Clue!


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

Date: Fri, 17 Oct 1997 06:07:38 GMT
From: hans.schrader@geol.uib.no (Hans Schrader)
Subject: Re: Win32, problem opening dir
Message-Id: <626vcb$ggs$2@toralf.uib.no>

In article <344657c8.2932067@intXnt>, eric@intiman.org_nospam (Eric) wrote:

Try using "normal" Unix style forward slashes! throughout. or use 
consistantly double backward sleashes. BUT not a mix of forward and or 
backward single double!


>OK, I'm missing something.  I'm new to using Perl, but I didn't think doing
>things with directories would give problems!
>
>Here is what I have been trying:
>
>chdir ("E:\PROGS\PMAIL\MAIL") || die ("Didn't cd to
>e:\\progs\\pmail\\mail\n");
>unless (opendir (PMAILDIR, "e:\progs\pmail\mail")) {
>        if (!(-e "e:\progs\pmail\mail")) {
>                die ("Directory e:\\progs\\pmail\\mail doesn't exist\n");
>        } elsif (!((-r "e:\progs\pmail\mail") && (-w
>"e:\progs\pmail\mail")))  {
>                die ("You are not allowed to read and write to directory
>e:\\progs\\pmail\\ \n");
>        } else {
>                die ("Directory e:\\progs\\pmail\\mail exists, but can't be
>opened\n");
>        }
>}
>
>As you all can see, I've been trying to find the problem.  Perl doesn't even
>think any directories exist!  I have tried other directories also and no go.
>
>What am I missing?
>
>Thanks!
>
>eric@intiman.org_nospam
>Eric Kylstra
>Computer Coordinator
>Intiman Theatre
>
>I have the nospam on the end of my email address for the obvious reason.
>Remove it to email me directly.

Hans Schrader from Bergen in Norway "Web-Eureka"
hansPERIODschraderSPAMbigfootPERIODcom = http://hjs.geol.uib.no/
[PERIOD="."SPAM="@"]  


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

Date: Thu, 16 Oct 1997 11:20:45 +0100
From: Mickael <mickael@adarweb.com>
Subject: wwwboard.pl
Message-Id: <3445EA7D.6CCE1798@adarweb.com>

Hello, 

Can anybaody help me with the following problem:

I am trying to use wwwwboard.pl which seems to work
but does not add messages to main forum page ? 

here is the forum URL:  http://www.adarweb.com/wwwboard/ 

Here are the variables setup: 

               # Define Variables 

               $basedir =
"/usr/local/etc/httpd/htdocs/wwwboard"; 
               $baseurl = "http://www.adarweb.com/wwwboard"; 
               $cgi_url =
               "http://www.adarweb.com/cgi-bin/wwwboard.pl"; 

               $mesgdir = "messages"; 
               $datafile = "data.txt"; 
               $mesgfile = "index.html"; 
               $faqfile = "faq.html"; 

               $ext = "html"; 

               $title = "Forum"; 

               # Configure Options 

               $show_faq = 1; # 1 - YES; 0 = NO 
               $allow_html = 1; # 1 = YES; 0 = NO 
               $quote_text = 1; # 1 = YES; 0 = NO 
               $subject_line = 1; # 0 = Quote Subject Editable;
1 =
               Quote Subject 
               # UnEditable; 2 = Don't Quote Subject, Editable. 
               $use_time = 1; # 1 = YES; 0 = NO 


               I have given the respective chmod permission to
files..

Thanks for helping me out,

email : gtie@club-internet.fr


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

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

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