[6374] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 996 Volume: 7

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Feb 23 13:07:15 1997

Date: Sun, 23 Feb 97 10:00:19 -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           Sun, 23 Feb 1997     Volume: 7 Number: 996

Today's topics:
     Re: Appending to the start of a File? (Tad McClellan)
     Re: Appending to the start of a File? (Guy Saner)
     Re: Help ! How to process @ character in a string ? (ALASTAIR AITKEN CLMS)
     Re: Help: DB_File? (Nathan V. Patwardhan)
     Re: localtime() year value broken? <jhi@alpha.hut.fi>
     Re: Mac port of Perl ftp site? (Andrew M. Langmead)
     Re: Matching before and after a word? (Dave Thomas)
     Re: Matching before and after a word? (Tad McClellan)
     Re: Pel5, BSDI, Libwww and various other critters. <khera@kcilink.com>
     Perl - Do I want to use it????? (---)
     Re: Perl as a shared library? (Andrew M. Langmead)
     Re: perl help  ... <merlyn@stonehenge.com>
     Record Length (Henry Lifton)
     Re: Regular Expression - Always seems simple/I always f (Laurel Shimer)
     Re: Resolving IP-addendum <buxx@buxx.com>
     Re: The Disappearing DOS box and cmd32.exe (Gregory Goodwin)
     Re: Web Form to Perl Problem (ALASTAIR AITKEN CLMS)
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

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

Date: Sun, 23 Feb 1997 07:34:54 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Appending to the start of a File?
Message-Id: <u1hpe5.v01.ln@localhost>


[ Where did that funky setting for Followups come from? Fixed...]


Guy Saner (gs@iscon.demon.co.uk) wrote:
: On 22 Feb 1997 13:26:27 GMT, mjtg@cus.cam.ac.uk (M.J.T. Guy) wrote:

: >Guy Saner <gs@iscon.demon.co.uk> wrote:
: >>
: >>I'm trying to get a routine working that opens a text file and appends a line
: >>to the start of it. I would also like it to remove the last line from it as
: >>well. The number of lines in the file will, therefore, be kept constant.
: >>I know I could read it all into an array and then UNSHIFT and POP, but
: >>can you think of a better way to do it.
: >
: >  perl -pi.bak -e 'BEGIN { $x="line to add\n" }; ($x,$_)=($_,$x)' myfile
: >
: >
: >Mike Guy

: How does this translate into a script file?


---------------
#!/usr/bin/perl -pi.bak

BEGIN { $x="line to add\n" }; ($x,$_)=($_,$x)
---------------

;-)



: It's for a CGI script. Yes I know you're going to tell me to ask
: in a CGI newsgroup, 


You misunderstand us ;-)

We only tell people to ask in the CGI newsgroup when they have a
question specific to CGI rather than specific to Perl.


How to convert a one-liner into a script is done the same way, whether
it is to be used as a 'normal' script or as a CGI script, so it is
a Q that is specific to Perl.

This is the correct newsgroup for that.


: but from my experience, the answers I get here are better.
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This is NO excuse to post to the wrong newsgroup (which you haven't
done, in this case, but it appears that you thought you were)


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


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

Date: Sun, 23 Feb 1997 17:07:36 GMT
From: gs@iscon.demon.co.uk (Guy Saner)
Subject: Re: Appending to the start of a File?
Message-Id: <331078d9.435399@news.demon.co.uk>
Keywords: *

On Sun, 23 Feb 1997 07:34:54 -0600, tadmc@flash.net (Tad McClellan) wrote:

>
>---------------
>#!/usr/bin/perl -pi.bak
>
>BEGIN { $x="line to add\n" }; ($x,$_)=($_,$x)
>---------------


Hi

The CGI script I'm using is quite large and needs to append
data to the front of different files. Is there a way to go without the
"-pi.bak", so I can use it as a subroutine.

Thanks
Guy


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

Date: 21 Feb 1997 10:35:14 GMT
From: zpalastair@unl.ac.uk (ALASTAIR AITKEN CLMS)
Subject: Re: Help ! How to process @ character in a string ?
Message-Id: <5ejtp2$d62@epsilon.qmw.ac.uk>

In article <32FBCCEF.3D25@student.monash.edu.au>, default user <default.user@g306.fcit.monash.edu.au> writes:

> $txt
>="http://user:password@abc.ct.monash.edu.au/~cvc/sdc.html?hidval=test";

You have to escape the '@' char in a double quoted string.  As:

> $txt
>="http://user:passwordi\@abc.ct.monash.edu.au/~cvc/sdc.html?hidval=test";

Alastair.


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

Date: 23 Feb 1997 15:12:11 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Help: DB_File?
Message-Id: <5epmob$cot@fridge-nf0.shore.net>

Mongkol Horburapa (q13382@bang.cig.mot.com) wrote:
: Is DB_File a buit-in module in Perl?

When I built Perl, I'd already installed Berkeley db(m), so DB_File
appeared in my libs directory.  You might want to a grab a Perl distribution
and check out the README/INSTALL files for information about DB_File.  I
suspect that you might have built Perl without Berkeley db(m) support,
so DB_File was never included.

--
Nathan V. Patwardhan
nvp@shore.net
"A stitch in time saves nine."


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

Date: 23 Feb 1997 19:09:02 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: localtime() year value broken?
Message-Id: <oeehgj34fgx.fsf@alpha.hut.fi>


> $year += 1900 will give a proper 4 digit year, even past the year 2000.
> However, after 2037 it stops working.  Here's some sample output:

Calculating the number of seconds between the 1st of January 1970 and
some day in 2038 and taking a logarithm base 2 of that number of
seconds left as an exercise.

-- 
$jhi++;
# Jarkko Hietaniemi <URL:http://www.iki.fi/~jhi/> <URL:mailto:jhi@iki.fi>
# Lost interest?  It's so bad I've lost apathy.
# Not speaking for any past, present, or future employers.


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

Date: Sun, 23 Feb 1997 16:12:27 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Mac port of Perl ftp site?
Message-Id: <E62D0s.EvF@world.std.com>

dehanks@bigfoot.com (RedFox) writes:

>Subject: Re: Mac port of Perl ftp site?
>Need I say more?
(I guess not, but it makes it harder to quote.)

The first place to look for ANYTHING to do with perl is:

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

For the macintosh port, 

<http://www.perl.com/CPAN/ports/mac/>
-- 
Andrew Langmead


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

Date: 23 Feb 1997 14:02:26 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: Matching before and after a word?
Message-Id: <slrn5h0jaj.568.dave@fast.thomases.com>

On 23 Feb 1997 12:44:44 GMT, Alex Kulbe <s_akulbe@rzw4.rz.uni-ulm.de> wrote:
> Hallo,
> 
> 1.
> I'm trying to match the word before and after a matched word.
> 
> @words = (one,two,three,four,five);
> 
> @match =~ grep (/three/,@words);

         ^^ wrong syntax - this operation binds a match. You just
	    need an '=' here.
	    
Do you words start out in a list? If not, what you want is easy in a regular
expression.

   $str = "one two three four) five";

   if ($str =~ m/(\w+)\s+three\s+(\w+)/) {
      print "Before = $1, after = $2\n";
   }

You can extend this to make either leading or trailing word optional,
returning undef for the corresponding $1/$3.

Regards

Dave


-- 

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


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

Date: Sun, 23 Feb 1997 07:52:30 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Matching before and after a word?
Message-Id: <u2ipe5.h31.ln@localhost>

Alex Kulbe (s_akulbe@rzw4.rz.uni-ulm.de) wrote:
: Hallo,

: 1.
: I'm trying to match the word before and after a matched word.

Huh?

The above says (to me, anyway) that you want three matches:

   1) 'matched word'
   2) 'word before matched word'
   3) 'word after matched word'

If what you were really trying to say was "I want to know the word
before and after the matched word", then see below.


: @words = (one,two,three,four,five);

-w complains loudly about the above 'bare words'.

ALWAYS use -w


: @match =~ grep (/three/,@words);
         ^^

Huh again? I guess you really wanted assignment (=) here?


: @match =~ grep (/three/,@words);
                  ^^^^^^^

This will also match 'threeHundred' you know...


: By using "$`" or "$'" I only get the hole substring.
: 2. How do I match the last word before a "\n"?

$lastword = $1 if $mystr =~ /(/w)$/;  # UNTESTED


: Any Ideas?
  ^^^^^^^^^

Always use -w ;-)


-----------------------------
#! /usr/bin/perl -w

@words = split /,/, "one,two,three,four,five,threeHundred";

for ($i=0; $i<@words; $i++) {
   last if $words[$i] =~ /^three$/;         # bail out when found
}

# what should we do if it is _not_ found...

print "before: $words[$i-1]\n";
print "after:  $words[$i+1]\n";

# carefully consider what would happen if we tried to match 'one' or 
# 'threeHundred' in the above @words array...
-----------------------------


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


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

Date: 23 Feb 1997 12:30:17 -0500
From: Vivek Khera <khera@kcilink.com>
Subject: Re: Pel5, BSDI, Libwww and various other critters.
Message-Id: <x7ybcfctw6.fsf@kci.kciLink.com>

If you want to build a Perl 5.003 for BSD/OS 2.1, use the following
config.sh.  The main trick is to use the system malloc library, and to
*NOT* strip the perl binary.

Also, you'll want to specify all the shared libs on the system as
"extra" link  libraries in case you ever use an extension that wants
one of them, such as the Tk extension.  The config.sh below does this
for you.

As for libwww, you will need to edit the GET/HEAD/POST script that
comes with it to change

  require Socket

to

  use Socket

and it too will work.

--cut here--
#!/bin/sh
#
# This file was produced by running the Configure script. It holds all the
# definitions figured out by Configure. Should you modify one of these values,
# do not forget to propagate your changes by running "Configure -der". You may
# instead choose to run each of the .SH files by yourself, or "Configure -S".
#

# Configuration time: Mon Oct 28 11:13:11 EST 1996
# Configured by: khera
# Target system: bsdos kci.kcilink.com 2.1 bsdi bsdos 2.1 kernel #8: fri oct 4 13:37:05 edt 1996 khera@kci.kcilink.com:ukci2syscompilekci i386 

Author=''
Date='$Date'
Header=''
Id='$Id'
Locker=''
Log='$Log'
Mcc='Mcc'
RCSfile='$RCSfile'
Revision='$Revision'
Source=''
State=''
afs='false'
alignbytes='4'
aphostname=''
ar='ar'
archlib='/usr/contrib/lib/perl5/i386-bsdos/5.003'
archlibexp='/usr/contrib/lib/perl5/i386-bsdos/5.003'
archname='i386-bsdos'
archobjs=''
awk='awk'
baserev='5.0'
bash=''
bin='/usr/contrib/bin'
binexp='/usr/contrib/bin'
bison=''
byacc='byacc'
byteorder='1234'
c=''
castflags='0'
cat='cat'
cc='shlicc2'
cccdlflags=' '
ccdlflags=' '
ccflags='-m486'
cf_by='khera'
cf_email='khera@kciLink.com'
cf_time='Mon Oct 28 11:13:11 EST 1996'
chgrp=''
chmod=''
chown=''
clocktype='clock_t'
comm='comm'
compress=''
contains='grep'
cp='cp'
cpio=''
cpp='cpp'
cpp_stuff='42'
cppflags='-m486'
cpplast='-'
cppminus='-'
cpprun='shlicc2 -E'
cppstdin='shlicc2 -E'
cryptlib=''
csh='csh'
d_Gconvert='sprintf((b),"%.*g",(n),(x))'
d_access='define'
d_alarm='define'
d_archlib='define'
d_attribut='define'
d_bcmp='define'
d_bcopy='define'
d_bsd='define'
d_bsdpgrp='define'
d_bzero='define'
d_casti32='define'
d_castneg='define'
d_charvspr='undef'
d_chown='define'
d_chroot='define'
d_chsize='undef'
d_closedir='define'
d_const='define'
d_crypt='define'
d_csh='define'
d_cuserid='undef'
d_dbl_dig='define'
d_difftime='define'
d_dirnamlen='define'
d_dlerror='define'
d_dlopen='define'
d_dlsymun='undef'
d_dosuid='define'
d_dup2='define'
d_eofnblk='define'
d_eunice='undef'
d_fchmod='define'
d_fchown='define'
d_fcntl='define'
d_fd_macros='define'
d_fd_set='define'
d_fds_bits='define'
d_fgetpos='define'
d_flexfnam='define'
d_flock='define'
d_fork='define'
d_fpathconf='define'
d_fsetpos='define'
d_getgrps='define'
d_gethent='undef'
d_gethname='undef'
d_getlogin='define'
d_getpgrp2='undef'
d_getpgrp='define'
d_getppid='define'
d_getprior='define'
d_htonl='define'
d_index='undef'
d_isascii='define'
d_killpg='define'
d_link='define'
d_locconv='define'
d_lockf='undef'
d_lstat='define'
d_mblen='define'
d_mbstowcs='define'
d_mbtowc='define'
d_memcmp='define'
d_memcpy='define'
d_memmove='define'
d_memset='define'
d_mkdir='define'
d_mkfifo='define'
d_mktime='define'
d_msg='undef'
d_msgctl='undef'
d_msgget='undef'
d_msgrcv='undef'
d_msgsnd='undef'
d_mymalloc='undef'
d_nice='define'
d_oldarchlib='define'
d_oldsock='undef'
d_open3='define'
d_pathconf='define'
d_pause='define'
d_phostname='undef'
d_pipe='define'
d_poll='undef'
d_portable='define'
d_pwage='undef'
d_pwchange='define'
d_pwclass='define'
d_pwcomment='undef'
d_pwexpire='define'
d_pwquota='undef'
d_readdir='define'
d_readlink='define'
d_rename='define'
d_rewinddir='define'
d_rmdir='define'
d_safebcpy='define'
d_safemcpy='undef'
d_seekdir='define'
d_select='define'
d_sem='undef'
d_semctl='undef'
d_semget='undef'
d_semop='undef'
d_setegid='define'
d_seteuid='define'
d_setlinebuf='define'
d_setlocale='define'
d_setpgid='define'
d_setpgrp2='undef'
d_setpgrp='define'
d_setprior='define'
d_setregid='define'
d_setresgid='undef'
d_setresuid='undef'
d_setreuid='define'
d_setrgid='define'
d_setruid='define'
d_setsid='define'
d_shm='undef'
d_shmat='undef'
d_shmatprototype='undef'
d_shmctl='undef'
d_shmdt='undef'
d_shmget='undef'
d_shrplib='undef'
d_sigaction='define'
d_sigintrp=''
d_sigsetjmp='define'
d_sigvec='define'
d_sigvectr='undef'
d_socket='define'
d_sockpair='define'
d_statblks='define'
d_stdio_cnt_lval='undef'
d_stdio_ptr_lval='undef'
d_stdiobase='undef'
d_stdstdio='undef'
d_strchr='define'
d_strcoll='define'
d_strctcpy='define'
d_strerrm='strerror(e)'
d_strerror='define'
d_strxfrm='define'
d_suidsafe='undef'
d_symlink='define'
d_syscall='define'
d_sysconf='define'
d_sysernlst=''
d_syserrlst='define'
d_system='define'
d_tcgetpgrp='define'
d_tcsetpgrp='define'
d_telldir='define'
d_time='define'
d_times='define'
d_truncate='define'
d_tzname='define'
d_umask='define'
d_uname='define'
d_vfork='undef'
d_void_closedir='undef'
d_voidsig='define'
d_voidtty=''
d_volatile='define'
d_vprintf='define'
d_wait4='define'
d_waitpid='define'
d_wcstombs='define'
d_wctomb='define'
d_xenix='undef'
date='date'
db_hashtype='u_int32_t'
db_prefixtype='size_t'
defvoidused='15'
direntrytype='struct dirent'
dlext='o'
dlsrc='dl_dlopen.xs'
dynamic_ext='DB_File Fcntl FileHandle NDBM_File POSIX SDBM_File Safe Socket'
eagain='EAGAIN'
echo='echo'
egrep='egrep'
emacs=''
eunicefix=':'
exe_ext=''
expr='expr'
extensions='DB_File Fcntl FileHandle NDBM_File POSIX SDBM_File Safe Socket'
find='find'
firstmakefile='makefile'
flex=''
fpostype='fpos_t'
freetype='void'
full_csh='/bin/csh'
full_sed='/usr/bin/sed'
gcc=''
gccversion='2.7.2'
gidtype='gid_t'
glibpth='/usr/shlib  /lib/pa1.1 /usr/lib/large /lib /usr/lib /usr/lib/386 /lib/386 /lib/large /usr/lib/small /lib/small /usr/ccs/lib /usr/ucblib /usr/shlib  /usr/X11/lib'
grep='grep'
groupcat=''
groupstype='gid_t'
h_fcntl='false'
h_sysfile='true'
hint='previous'
hostcat=''
huge=''
i_bsdioctl=''
i_db='define'
i_dbm='undef'
i_dirent='define'
i_dld='undef'
i_dlfcn='define'
i_fcntl='undef'
i_float='define'
i_gdbm='undef'
i_grp='define'
i_limits='define'
i_locale='define'
i_malloc='undef'
i_math='define'
i_memory='undef'
i_ndbm='define'
i_neterrno='undef'
i_niin='define'
i_pwd='define'
i_rpcsvcdbm='undef'
i_sgtty='undef'
i_stdarg='define'
i_stddef='define'
i_stdlib='define'
i_string='define'
i_sysdir='define'
i_sysfile='define'
i_sysfilio='define'
i_sysin='undef'
i_sysioctl='define'
i_sysndir='undef'
i_sysparam='define'
i_sysselct='define'
i_syssockio=''
i_sysstat='define'
i_systime='define'
i_systimek='undef'
i_systimes='define'
i_systypes='define'
i_sysun='define'
i_termio='undef'
i_termios='define'
i_time='undef'
i_unistd='define'
i_utime='define'
i_varargs='undef'
i_varhdr='stdarg.h'
i_vfork='undef'
incpath=''
inews=''
installarchlib='/usr/contrib/lib/perl5/i386-bsdos/5.003'
installbin='/usr/contrib/bin'
installman1dir='/usr/contrib/man/man1'
installman3dir='/usr/contrib/man/man3'
installprivlib='/usr/contrib/lib/perl5'
installscript='/usr/contrib/bin'
installsitearch='/usr/contrib/lib/perl5/site_perl/i386-bsdos'
installsitelib='/usr/contrib/lib/perl5/site_perl'
intsize='4'
known_extensions='DB_File Fcntl FileHandle GDBM_File NDBM_File ODBM_File POSIX SDBM_File Safe Socket'
ksh=''
large=''
ld='shlicc2'
lddlflags='-r -L/usr/X11/lib -L/usr/local/lib'
ldflags=' -L/usr/X11/lib -L/usr/local/lib'
less='less'
lib_ext='.a'
libc='/usr/lib/libc.a'
libpth='/usr/local/lib /usr/lib /usr/X11/lib'
libs='-lrpc -lcurses -ltermcap -lXpm -lXaw -lXmu -lXt -lSM -lICE -lXext -lX11 -ldl -lm'
libswanted='net socket inet nsl ndbm gdbm dbm db malloc dl dld ld sun m c cposix posix ndir dir crypt ucb bsd BSD PW x'
line='line'
lint=''
lkflags=''
ln='ln'
lns='/bin/ln -s'
locincpth='/usr/local/include /opt/local/include /usr/gnu/include /opt/gnu/include /usr/GNU/include /opt/GNU/include'
loclibpth='/usr/local/lib /opt/local/lib /usr/gnu/lib /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib'
lp=''
lpr=''
ls='ls'
lseektype='off_t'
mail=''
mailx=''
make=''
mallocobj=''
mallocsrc=''
malloctype='void *'
man1dir='/usr/contrib/man/man1'
man1direxp='/usr/contrib/man/man1'
man1ext='1'
man3dir='/usr/contrib/man/man3'
man3direxp='/usr/contrib/man/man3'
man3ext='3'
medium=''
mips=''
mips_type=''
mkdir='mkdir'
models='none'
modetype='mode_t'
more='more'
mv=''
myarchname='i386-bsdos'
mydomain='.kcilink.com'
myhostname='kci'
myuname='bsdos kci.kcilink.com 2.1 bsdi bsdos 2.1 kernel #8: fri oct 4 13:37:05 edt 1996 khera@kci.kcilink.com:ukci2syscompilekci i386 '
n='-n'
nm_opt=''
nm_so_opt=''
nroff='nroff'
o_nonblock='O_NONBLOCK'
obj_ext='.o'
oldarchlib=''
oldarchlibexp=''
optimize='-O'
orderlib='false'
osname='bsdos'
osvers='2.1'
package='perl5'
pager='/usr/contrib/bin/less'
passcat=''
patchlevel='3'
path_sep=':'
perl='perl'
perladmin='none'
perlpath='/usr/contrib/bin/perl'
pg='pg'
phostname='hostname'
plibpth=''
pmake=''
pr=''
prefix='/usr/contrib'
prefixexp='/usr/contrib'
privlib='/usr/contrib/lib/perl5'
privlibexp='/usr/contrib/lib/perl5'
prototype='define'
randbits='31'
ranlib='/usr/bin/ranlib'
rd_nodata='-1'
rm='rm'
rmail=''
runnm='true'
scriptdir='/usr/contrib/bin'
scriptdirexp='/usr/contrib/bin'
sed='sed'
selecttype='fd_set *'
sendmail='sendmail'
sh=''
shar=''
sharpbang='#!'
shmattype=''
shrpdir='none'
shsharp='true'
sig_name='ZERO HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM URG STOP TSTP CONT CHLD TTIN TTOU IO XCPU XFSZ VTALRM PROF WINCH INFO USR1 USR2 IOT '
sig_num='0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 6 '
signal_t='void'
sitearch='/usr/contrib/lib/perl5/site_perl/i386-bsdos'
sitearchexp='/usr/contrib/lib/perl5/site_perl/i386-bsdos'
sitelib='/usr/contrib/lib/perl5/site_perl'
sitelibexp='/usr/contrib/lib/perl5/site_perl'
sizetype='size_t'
sleep=''
smail=''
small=''
so='o'
sockethdr=''
socketlib=''
sort='sort'
spackage='Perl5'
spitshell='cat'
split=''
ssizetype='ssize_t'
startperl='#!/usr/contrib/bin/perl'
startsh='#!/bin/sh'
static_ext=' '
stdchar='char'
stdio_base='((fp)->_base)'
stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)'
stdio_cnt='((fp)->_cnt)'
stdio_ptr='((fp)->_ptr)'
strings='/usr/include/string.h'
submit=''
subversion='0'
sysman='/usr/share/man/man1'
tail=''
tar=''
tbl=''
test='test'
timeincl='/usr/include/sys/time.h '
timetype='time_t'
touch='touch'
tr='tr'
troff=''
uidtype='uid_t'
uname='uname'
uniq='uniq'
usedl='define'
usemymalloc='n'
usenm='true'
useposix='true'
usesafe='true'
usevfork='false'
usrinc='/usr/include'
uuname=''
vi=''
voidflags='15'
xlibpth='/usr/lib/386 /lib/386'
zcat=''
PATCHLEVEL=3
SUBVERSION=0
LOCAL_PATCH_COUNT=\
CONFIG=true
# Variables propagated from previous config.sh file.
pp_sys_cflags='ccflags="$ccflags -DHAS_TELLDIR_PROTOTYPE"'
--cut here--

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.                Khera Communications, Inc.
Internet: khera@kciLink.com       Rockville, MD       +1-301-258-8292
PGP/MIME spoken here              http://www.kciLink.com/home/khera/


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

Date: Sun, 23 Feb 1997 16:51:18 GMT
From: bailey766@aol.com (---)
Subject: Perl - Do I want to use it?????
Message-Id: <5epi6c$3m0@dfw-ixnews4.ix.netcom.com>

Please help me get started...

MY GOAL:  To create a web site hosted on either my ISP or another
hosting service withdynamic content (CGI scripting most likely).  It
is mostly experimental, for my learning, but I will need at least 5 or
10 megs of free space.  I would like to learn as much of the
"industry standard" way of doing things as possible, however, I do not
have UNIX boxes athome for testing.  I really want to write a
simulated order-entry system using some sort of database access.  I am
not really looking to do animation of any kind.

MY EQUIPMENT:  I have a small NT server network with one Win95 machine
attached.

WEB SERVER SOFTWARE:  I have Microsoft Internet Information server 2.0
which came  with NTServer, and I have installed Active Server Pages
(which if I am correct, upgraded my version of IIS from 2.0 to 3.0).
I also have O'Reilly's Website 1.1d and Website
Pro upgrade.

PROGRAMMING TOOLS:  Visual Basic 4.0 Enterprise, Delphi 2.0 Developer,
Borland C++ 3.1, Turbo Pascal/DOS.  Symantec Cafe 1.0, Visual J++,
Access 2.0 and 95, etc.  I also have Microsoft Front Page for creating
HTML pages.

CURRENT KNOWLEDGE:  Fluent in VB/Access, have written simple Java and
Delphi programs, have written fairly large Pascal and C programs
(although the C programs were ANSI C, not C++).  Working knowledge of
HTML and writing simple CGI programs, I have worked through
the Microsoft Active Server Page tutorial as well.  A good overall
understanding of CGI.
Not much UNIX experience at all.  I have looked at PERL but it appears
that all the tutorials use UNIX in the examples.

MY PERSPECTIVE:  I think the obvious "easy" solution is to go the
Microsoft way and use VB to write my CGI scripts using either Internet
Information Server or Website Pro.  This would make it easy to test my
stuff locally.  However easy is not necessarily a priority, I am a
competent programmer and have no problem using C to create the
scripts.  I want to learn the technology that will make me the most
valuable in the workplace, but at the same time I want to be able to
have access to a large number of web hosting services.  To
me, this seems like an impossible goal, since most web hosting
services appear to be running UNIX/Apache as their web server
software, or an obscure web server I have not heard of.

MY QUESTIONS:  ACK!  Where to start!?!  

1. I need to test my website locally using the tools
listed above.  What is the best route to take?  

2. Can someone recommend a web hosting service that provides
inexpensive hosting ($20-40 per month for 5-10 megs or so) and is
compatible with either Microsoft IIS 3.0 or OReilly's Web Site Pro?

3.  Has anyone who is currently working with IIS or Website Pro been
in my shoes before? Overwhelmed with all the hype but not sure where
to start?

4.  Should I use my ancient Borland compiler to create DOS ANSI C
scripts, then upload them to a UNIX host for recompilation?  Are there
any problems I need to be aware of?

5.  Are Active Server Pages/Active X the way of the future?

6.  Should I learn PERL, since it appears to be the most
platform-indepenent and it is interpreted?  If so, where do I start?
Keep in mind that any PERL programming I do must be done under Windows
NT and/or Windows 95.

7.  What are the best newsgroups for someone at my (obviously novice)
level?

Please help if you can, and please forward a copy of your response to
my e-mail if at all possible.




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

Date: Sun, 23 Feb 1997 16:09:11 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Perl as a shared library?
Message-Id: <E62CvB.DIB@world.std.com>

Marius Kjeldahl <marius@funcom.com> writes:

>1) Will upcoming versions (5.004?) have support for building perl as a
>shared library (typically with a small executable that fires up this
>library)? I have been told that someone at SGI did this with 5.003.

5.003 is able to be built with libperl.a as a shared library. The
Configure script didn't ask if you wanted it though, so you had to
edit config.sh by hand.

>2) If so, what are the implications for using perl for scripting? Will
>the startup time be significantly smaller (assuming the OS "caches"
>the shared library in memory)?

Probably not. Since if the OS "caches" frequently used shared library
images, it could and will cache frequently used executable images. It
will probably be a bit slower since there are symbol table fixups that
will need to be done when perl is loaded.

It will allow smaller executables from the perl compiler. And smaller
memory requirements of them too since the different executables
produced from the perl compiler can share the perl shared library.
-- 
Andrew Langmead


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

Date: 23 Feb 1997 08:52:53 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: dcon@eden.com
Subject: Re: perl help  ...
Message-Id: <8czpwvfrje.fsf@gadget.cscaper.com>

>>>>> "dcon" == dcon  <dcon@eden.com> writes:

dcon> Ohhhh.  do this:
dcon> (...perl purists will undoubtedly smash this with a one liner)

dcon> while(<>){
dcon> 	$inside++ if (/^\.subckt pdp/);
dcon> 	$inside=0 if (/^\.ends subckt/);
dcon> 	s/^xm3/xm5/ if ($inside);
dcon> }

Sure.  As you requested...

	perl -pe 's/^xm3/xm5/ if /^\.subckt pdp/../^\.ends subckt/' in >out

dcon> Of course, you'll have to open the file to write, and file to read...

Did that. :-)

Learn to use ".." -- it can come in handy whenever you have a bistable
"state" like this.

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

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


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

Date: Sun, 23 Feb 1997 17:21:45 GMT
From: henlif@elsfl.com (Henry Lifton)
Subject: Record Length
Message-Id: <5epu7g$9jm$1@amberjack.netrunner.net>
Keywords: Record Length Perl

It has been a year or so since I wrote a program in Perl. It was in Perl 4.  
At that time there was a limitation to the length of a record in a data base 
(I believe it was 1,000 bytes).

In order to get data out of a database with long memo fields, I had to have 
the field contain only the file name & path.  Then I would be able to print it 
with  "cat /dev/nul/path_and__filename".

Is there still such a limit in Perl 5.x or has that been removed?

Any help would be greatly appreciated.

Thanks

Henry Lifton
henlif@elsfl.com


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

Date: Sun, 23 Feb 1997 09:13:36 -0700
From: autopen@quake.net (Laurel Shimer)
Subject: Re: Regular Expression - Always seems simple/I always fight 'em
Message-Id: <autopen-2302970913360001@l18.d22.quake.net>

For other who have mental blocks with regular expressions I have
summarized the answers to my question. Note one uses regular expressions
and the second uses 'tr'. 

My basic problem was that I was using '*' instead of '+'. A lot of my
mental block seems to relate to the use of special characters. And I'm
always sure it's something else.

Note: I should have been more explicit about my desires - I wanted to be
sure that the value I was checking was entirely numeric. This is made
clear (as mud?) in the second example using 'tr'. It was addressed, ever
so kindly, by John in his response to me.

Thanks to all who wrote back. I have included the complete text of all
postings at the end.

Laurel
------------------------ Regexp methods that work ------
$number = "22";
$string = "string";
$checkit = $number;
CheckIt();

$checkit = $string;
CheckIt();

exit(0);
 
sub CheckIt {

print "METHOD 1 \n";
if (($checkit !~  /^\d+$/)) { print "$checkit is not a digit \n"}
else { print "$checkit is a digit\n"; }

print "METHOD 2 \n";
if (($checkit =~  /^\D+$/)) { print "$checkit is not a digit \n"}
else { print "$checkit is a digit\n"; }

print "METHOD 3 \n";
if (!($checkit =~  /^\d+$/)) { print "$checkit is not a digit \n"}
else { print "$checkit is a digit\n"; }

return(0);
}
-----------------------tr method that works----------------------
$string = "string";
$number = "999";
$alphanum = "123 Main Street";

$answer1 = allDigits($string); 

$answer2 = allDigits($number); 
$answer3 = allDigits($alphanum); 

if ($answer1) {print "$string is all digits \n";}
if ($answer2) {print "$number is all digits \n";}
if ($answer3) {print "$alphanum is all digits \n";}

 sub allDigits
    {
   my ($parm) = $_[0];
   chomp ($parm);
   return !($parm =~ tr/0-9//c);
   }

----------------------------------Summary All Responses-----
Date: Sun, 23 Feb 1997 00:37:35 -0600
From: Dave Thomas <dave@Thomases.com>
To: autopen@quake.net
Posted-To: comp.lang.perl.misc
Subject: Re: Regular Expression - Always seems simple/I always fight 'em
Organization: Thomas Consulting
Reply-To: Dave@Thomases.com

[This message has also been posted.]
On Sat, 22 Feb 1997 19:33:06 -0700, Laurel Shimer <autopen@quake.net> wrote:
> 
> print "METHOD 1 \n";
> if (($checkit !~ /\d*/)) { print "$checkit is not a digit \n"}
> else { print "$checkit is a digit\n"; }
> 
> print "METHOD 2 \n";
> if (($checkit =~ /\D*/)) { print "$checkit is not a digit \n"}
> else { print "$checkit is a digit\n"; }
> 
> print "METHOD 3 \n";
> if (!($checkit =~ /\d*/)) { print "$checkit is not a digit \n"}
> else { print "$checkit is a digit\n"; }

In all three cases your regex isn't matching what you said you wanted.

You said you want to test if a string contains all digits.

Paraphrase that: every character in the string must be a digit.

What does /\d*/ match?  Well, \d matches a digit, and '*' modifies that to
say zero or more. But wait a minute. Anything will match zero or more digits. 

The rest have the same kind of problem.

Go back to the original statement of the problem. All the characters in the
string must be digits. Or, more pedantically, every character between the
first and last must be digits. I guess we should also say that there must be
at least one digit in the string. So

     $checkit =~  /^        # start of the string
                    \d+     # one or more digits (and only these
         $        # until the end of the string
        /x;
        
'*' qualifies in regex can be tricky (and inefficient) things. Always
remember that they imply the preceding item can be optional.

Hope that helps

Dave.

-- 

 _________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Date: Sat, 22 Feb 1997 22:39:42 -0800
From: Devin Ben-Hur <dbenhur@egames.com>
Reply-To: dbenhur@egames.com
Organization: eGames, Inc.
MIME-Version: 1.0
Newsgroups: comp.lang.perl.misc
To: Laurel Shimer <autopen@quake.net>
Subject: Re: Regular Expression - Always seems simple/I always fight 'em

Laurel Shimer wrote:
> Would you please be so kind as to respond directly to my e-mail address
> (autopen@quake.net)? My server/newsreader connection is unreliable.

Well, sure, but it also goes to the newsgroup (public questions 
get public answers)...

> I have consulted the great LLama and Camel books.
> I have stared at my P.Ref Guide

Well, these *should* have answered your simple regex question,
but if you want more, try Jeffrey Friedl's "Using Regular 
Expressions".

> I just want to test a variable and know if it contains ALL digits or not.
> Gee it seems it ought to be some straightforward use  of \d or \D.

it is, use ^ and $ to anchor expression at beginning and end
of string, \d+ to test for one or more digits:

sub is_all_digits {
    my $str = shift;
    return ($str =~ /^\d+$/); # returns true if string is 1 or more
digits
                              # and nothing else
}

$test = "123";
print "'$test' is all digits\n" if is_all_digits($test);

> $checkit = $number;
> CheckIt();

You need to learn how to write subroutines too, passing function args
as global variables is very bad form.

HTH
--
Devin Ben-Hur      <dbenhur@egames.com>
eGames.com, Inc.   http://www.egames.com/
eMarketing, Inc.   http://www.emarket.com/
"Don't run away. We are your friends."  O-
Sender: root@danger.mbnet.mb.ca
Date: Sun, 23 Feb 1997 00:44:59 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Organization: not-much
MIME-Version: 1.0
To: Laurel Shimer <autopen@quake.net>
Subject: Re: Regular Expression - Always seems simple/I always fight 'em

Laurel Shimer wrote:
> 
snip

> I just want to test a variable and know if it contains ALL digits or not.
> Gee it seems it ought to be some straightforward use  of \d or \D.
> 
> Below are all three versions I tried - which as you can quite clearly see,
> do not give the desired result.
> 
> Can you tell me what it is I just don't understand?
> 
> Thank you.
> 
> Laurel Shimer
> 
> Sample Code
> -------------
> shellx 16% perl5
> $number = "22";
> $string = "string";
> $checkit = $number;
> CheckIt();
> 
> $checkit = $string;
> CheckIt();
> 
> exit(0);
> 
> sub CheckIt {
> 
> print "METHOD 1 \n";
> if (($checkit !~ /\d*/)) { print "$checkit is not a digit \n"}
> else { print "$checkit is a digit\n"; }
> 
> print "METHOD 2 \n";
> if (($checkit =~ /\D*/)) { print "$checkit is not a digit \n"}
> else { print "$checkit is a digit\n"; }
> 
> print "METHOD 3 \n";
> if (!($checkit =~ /\d*/)) { print "$checkit is not a digit \n"}
> else { print "$checkit is a digit\n"; }
> 


ok, first thing to realize is that * means zero or more:
/\d*/
means can i find zero or more digits...it can always find zero
digits, the null at the beginning of a string for example
/\d+/ means one or more digits, and if a string is either 
entirely a number or entirely a string this will do what you want.

however, what about $checkit="123abc";  the regex would still find
some digits and match.

use /^\d+$/;   the ^ means the match must begin at the start of
the string, the $ means it must also end at the end of the string;
thus the entire string must be digits (and must be at least one digit).

regards
andrew
Date: Sun, 23 Feb 1997 02:19:13 -0500
From: Dennis Marti <marti@netrail.net>
To: autopen@quake.net (Laurel Shimer)
Subject: Re: Regular Expression - Always seems simple/I always fight 'em
Newsgroups: comp.lang.perl.misc
Organization: NetRail, Inc. Your Gateway to the World!      (703)524-4800
X-Newsreader: TIN [UNIX 1.3 950515BETA PL0]

Laurel,

'*' matches zero or more of the preceding thing, so /\d*/ matches
anything. '+' matches one or more of the preceding atom, so /\d+/ only
matches strings with at least one number. Anchoring that at the
beginning and end of the pattern ( /^\d+$/ ) will match something with
at least one digit and nothing but digits. I stuck this in the code
below.

If you need an empty string to match (because it contains no non-digits)
leave the anchors and change the + to *.

In article <autopen-2202971933060001@l94.d22.quake.net> you wrote:
: Problem

: I just want to test a variable and know if it contains ALL digits or not.
: Gee it seems it ought to be some straightforward use  of \d or \D.

   foreach ("22", "string") {
      if (/^\d+$/) {
         print "'$_' contains only digits\n";
      }
      else {
         print "'$_' contains non-digits\n";
      }
   }

Hope this helps.

Dennis Marti
Date: Sun, 23 Feb 1997 01:52:37 -0800 (PST)
From: "John C. Randolph" <jcr@idiom.com>
To: autopen@quake.net
Subject: Re: Regular Expression - Always seems simple/I always fight 'em
Newsgroups: comp.lang.perl.misc
X-Newsreader: NN version 6.5.0 #1 (NOV)

In comp.lang.perl.misc you write:

Laurel,

The heart of the problem here, is that this is not a job for pattern
matching.

This is a job for digit counting.

As Larry and Randall are so fond of saying,

"There's more than one way to do it!" (tm)

This is the first way that sprung to mind: 

  $_ = "12345890";
  print "all digits!" unless (length $_) ne ($_ =~ tr/0-9//);

If the number of digits you count is equal to the number of characters
in the string, then it's all digits.

(remember that tr/// returns the number of characters translated, and if the
replacement character set is empty, then the string isn't changed.)

This is the second way that I thought of.  It's much shorter: 

  tr/0-9//c;  

This will return the number of non-digits in $_.  If you want it
as a boolean value, then try:

  $allDigits = !(tr/0-9//c);

Note that if you're reading these strings from <STDIN>, you might
need to chomp() them first (in perl 5.x, that is.) In Perl 4, you'd
use chop().

And now to generalize it:

  sub allDigits
    {
   my ($string) = @_;
   chomp ($string);
   return !($string =~ tr/0-9//c);
   }

-jcr

(yet another perl hacker, despite great pressure from my friends
to move to Python. ;-)

PS: This could be done with a pattern match, but that's more work, and
lazy code is good code!

-- 
        The Reader's Corner: Mystery, Romance, Fantasy 
     Short stories, excerpts, themes and resources 
        http://www.autopen.com/index.shtml 
     Subscribe to our free StoryBytes publication
Current Mermaids Issue at http://www.autopen.com/mermaids.shtml


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

Date: Sun, 23 Feb 1997 10:11:46 -0600
From: Steve Vandiver <buxx@buxx.com>
Subject: Re: Resolving IP-addendum
Message-Id: <33106C42.338@buxx.com>

Steve Vandiver wrote:
> 
> Need to resolve my currnet IP address
> 
> Any help ??

I currently run a perl script that runs ifconf ppp0 and I extract several pieces of info out of 
this. Is there a variable or function that I can call to get my current ppp address in a shorter 
manner.  This is not within a cgi-bin.


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

Date: Sun, 23 Feb 1997 16:02:16 GMT
From: gm-goodwin@worldnet.DOT.att.DOT.net (Gregory Goodwin)
Subject: Re: The Disappearing DOS box and cmd32.exe
Message-Id: <33116a05.4920848@netnews2.worldnet.att.net>

I wish it were that simple.  No, it does not work here.  The way I
understand it Perl is a 16bit Windows program, and Win95 runs it, not
from DOS, but from an application called conagent.exe. (There appears
to be very little documentation about conagent.)  But it closes no
matter what boxes are checked or unchecked.  

The main thing is I want to see the error messages.  I've tried
redirection...
	open(STDERR, "> err.txt"):
 ..does not work.

I've found a somewhat awkward workaround.  When I want to debug and
see the error messages, I send the .pl to a batch file.  I type ...
	perl.bat filename.pl

The batch file looks like...
	@echo off
	"cmd32.exe" "Perl.exe" "%1" "%2""%3" "%4"
	@echo on
It comes up on a real DOS box and stays open.

There are problems with this.  When I send a .pl file directly to
cmd32.exe I can redirect STDOUT to a txt file.  But when I use the
batch file, STDOUT will not redirect.

** 
If someone has a better solution, please let us know.  There must be a
better way.

Thanks 
Gregory



On Sat, 22 Feb 1997 15:40:21 -0800, Larry Clapp <lclapp@intnet.net>
wrote:

>[ Curtesy e-mail sent to author cited. ]
>
>Gregory Goodwin wrote:
>> 
>> I've installed Perl5 on Win95 and associated .pl files with perl.exe.
>> The problem though is that the DOS box disappears too fast to read.
>
>Gregory,
>
>I'm too new to Win95 to tell you how to do this mechanically, but
>if you start a DOS window, right-click on the title bar and pull down
>properties, there's a box labeled CLOSE ON EXIT.  If you arrange to
>uncheck it in the window your Perl script runs it, it'll probably stay
>open until you close it.
>
>Hope this helps, and reply if I'm wrong!  :)
>
>-- Larry
>



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

Date: 21 Feb 1997 10:45:57 GMT
From: zpalastair@unl.ac.uk (ALASTAIR AITKEN CLMS)
Subject: Re: Web Form to Perl Problem
Message-Id: <5ejud5$d62@epsilon.qmw.ac.uk>

In article <330d7284.253104955@news.gte.net>, solari@gte.net (Raymond Hines) writes:

><form method=POST
>action="http://www.gatorcountry.org/cgi-bin/mill.pl">
><INPUT NAME=site TYPE=radio VALUE=rumor> Discussion & Rumors  <br>
><INPUT NAME=site TYPE=radio VALUE=news> News & Information

One thing I always do is enclose input names and values in double quotes:

<INPUT NAME="site" TYPE=radio VALUE="rumor"> Discussion & Rumors  <br>
<INPUT NAME="site" TYPE=radio VALUE="news"> News & Information

as with the action statement.

Alastair.


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

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

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