[6827] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 452 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 8 15:17:35 1997

Date: Thu, 8 May 97 12:00:26 -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           Thu, 8 May 1997     Volume: 8 Number: 452

Today's topics:
     Re: "Bad free() ..." message from perl v4.036 (Earl Hood)
     Re: An question about CGI.pm <damon@netserver.stanford.edu>
     config.sh for large files on AIX 4.2 (Bob Shair)
     Re: Drawing a graph? (Nathan V. Patwardhan)
     Re: Drawing a graph? (Mont Erickson)
     Re: FTP support in perl <pat@episun1.med.utah.edu>
     Re: FTP support in perl <pat@episun1.med.utah.edu>
     Re: GIF in Base64 encoding? <aas@bergen.sn.no>
     Re: Help a Newbie (please) <Jan.Krynicky@st.ms.mff.cuni.cz>
     HP OV SNMP Question ldavis@reston.ans.net
     MacPerl question <Erik_Perkins@nt.com>
     Re: Modifying D-Base fields with PERL. <lpeters@aol.net>
     ODBC Library for Perl & UNIX (Paul Vermette)
     Re: Perl for Dummies Book (Geordie Korper)
     Re: Perl-Socket using in C ??? <rra@stanford.edu>
     Re: program for perl? (Joel Coltoff)
     quoting a separator for split() <melling@panix2.panix.com>
     Regular Expression/Associative Array Bug??? (Mont Erickson)
     Re: Require assistance with function stat <usenet-tag@qz.little-neck.ny.us>
     scrambling the elements of any array?? <jong@mrc-lmb.cam.ac.uk>
     Sending e-mail from within a perl script - help (John Sheehy)
     Re: Something I'm missing <Jan.Krynicky@st.ms.mff.cuni.cz>
     Re: Something I'm missing (David Alan Black)
     Re: Something I'm missing (David Alan Black)
     STRAW POLL: RFD: comp.lang.perl reorg (A. Deckers)
     Re: Trash can or wastebasket for Unix <usenet-tag@qz.little-neck.ny.us>
     using CGI::Request w/o CGI::Carp (Tim  Smith)
     Re: variable  names <Jan.Krynicky@st.ms.mff.cuni.cz>
     Re: variable  names <rra@stanford.edu>
     Re: variable names (David Alan Black)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 8 May 1997 17:14:29 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: "Bad free() ..." message from perl v4.036
Message-Id: <5kt1ll$bv8@news.service.uci.edu>

In article <cs207ialdd.fsf@Starbase.NeoSoft.COM>,
Kent Perrier <kperrier@Starbase.NeoSoft.COM> wrote:
>
>Then why are you running it under perl4?  

Because not all users of the program have access to Perl 5.  Believe
it or not, some users of Perl have yet to migrate (due to business,
political, and/or time issues).  I do not have time to give lessons
on economics, business politics, and human resource management, so
if you (and others) do not know an answer to the original question,
please do not respond.

BTW, I am well aware of the status of Perl 4.

	--ewh
-- 
             Earl Hood              | University of California: Irvine
      ehood@medusa.acs.uci.edu      |      Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME


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

Date: Thu, 08 May 1997 10:51:12 -0700
From: Conrad Damon <damon@netserver.stanford.edu>
To: Cheng Tyh Lin <a00lcj00@elc010.nchc.gov.tw>
Subject: Re: An question about CGI.pm
Message-Id: <33721290.794B@netserver.stanford.edu>

Cheng Tyh Lin wrote:

> print textfield(-name=>'MYNAME', -default=>$myname),
>         scrolling_list(-name=>'OPEN_LEVEL_1',
>         -values=>['a','b','c'],
>         -default=>['a','c'],     #<===== this line cannot work properly
>         -size=>3,
>         -multiple=>'true',
>         -labels=>\%tmp),
>         submit(-value=>'SUBMIT'), reset(-value=>'RESET'),
>         end_html;

Try adding

	-override=>1,

to the attributes. That always works for me. I asked about this a long
time ago and the answer was something to the effect that the true
defaults are the form variables that come in (even if they're empty),
and you have to override those.

Conrad


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

Date: 8 May 1997 18:15:59 GMT
From: rmshair@uiuc.edu (Bob Shair)
Subject: config.sh for large files on AIX 4.2
Message-Id: <5kt58v$in7@vixen.cso.uiuc.edu>

#!/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: Wed May  7 22:02:59 CDT 1997
# Configured by: root
# Target system: aix butch 2 4 00080900A70

Author=''
Date='$Date'
Header=''
Id='$Id'
Locker=''
Log='$Log'
Mcc='Mcc'
RCSfile='$RCSfile'
Revision='$Revision'
Source=''
State=''
afs='false'
alignbytes='8'
aphostname=''
ar='ar'
archlib='/usr/local/lib/perl5/aix/5.003'
archlibexp='/usr/local/lib/perl5/aix/5.003'
archname='aix'
archobjs=''
awk='awk'
baserev='5.0'
bash=''
bin='/usr/local/bin'
binexp='/usr/local/bin'
bison=''
byacc='byacc'
byteorder='4321'
c='\c'
castflags='1'
cat='cat'
cc='cc'
cccdlflags=' '
ccdlflags='-bE:perl.exp'
ccflags='-qmaxmem=8192 -D_LARGE_FILES -qarch=com -qtune=604 -qflag=I:E -D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -I/usr/local/include -D_NO_PROTO'
cf_by='root'
cf_email='bshair@butch.csci.csc.com'
cf_time='Wed May  7 22:02:59 CDT 1997'
chgrp=''
chmod=''
chown=''
clocktype='clock_t'
comm='comm'
compress=''
contains='grep'
cp='cp'
cpio=''
cpp='cpp'
cpp_stuff='42'
cppflags='-qmaxmem=8192 -D_LARGE_FILES -qarch=com -qtune=604 -qflag=I:E -D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -I/usr/local/include -D_NO_PROTO'
cpplast=''
cppminus=''
cpprun='/usr/lib/cpp'
cppstdin='cppstdin'
cryptlib=''
csh='csh'
d_Gconvert='gcvt((x),(n),(b))'
d_access='define'
d_alarm='define'
d_archlib='define'
d_attribut='undef'
d_bcmp='define'
d_bcopy='define'
d_bsd='define'
d_bsdpgrp='undef'
d_bzero='define'
d_casti32='define'
d_castneg='undef'
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='define'
d_dbl_dig='define'
d_difftime='define'
d_dirnamlen='define'
d_dlerror='define'
d_dlopen='define'
d_dlsymun='undef'
d_dosuid='undef'
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='define'
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='define'
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='define'
d_msgctl='define'
d_msgget='define'
d_msgrcv='define'
d_msgsnd='define'
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='define'
d_portable='define'
d_pwage='undef'
d_pwchange='undef'
d_pwclass='undef'
d_pwcomment='undef'
d_pwexpire='undef'
d_pwquota='undef'
d_readdir='define'
d_readlink='define'
d_rename='define'
d_rewinddir='define'
d_rmdir='define'
d_safebcpy='define'
d_safemcpy='define'
d_seekdir='define'
d_select='define'
d_sem='define'
d_semctl='define'
d_semget='define'
d_semop='define'
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='undef'
d_setresgid='undef'
d_setresuid='undef'
d_setreuid='undef'
d_setrgid='undef'
d_setruid='undef'
d_setsid='define'
d_shm='define'
d_shmat='define'
d_shmatprototype='define'
d_shmctl='define'
d_shmdt='define'
d_shmget='define'
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='define'
d_stdio_ptr_lval='define'
d_stdiobase='define'
d_stdstdio='define'
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='undef'
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='undef'
d_waitpid='define'
d_wcstombs='define'
d_wctomb='define'
d_xenix='undef'
date='date'
db_hashtype='int'
db_prefixtype='int'
defvoidused='15'
direntrytype='struct dirent'
dlext='so'
dlsrc='dl_aix.xs'
dynamic_ext='Fcntl FileHandle NDBM_File ODBM_File POSIX SDBM_File Safe Socket'
eagain='EAGAIN'
echo='echo'
egrep='egrep'
emacs=''
eunicefix=':'
exe_ext=''
expr='expr'
extensions='Fcntl FileHandle NDBM_File ODBM_File POSIX SDBM_File Safe Socket'
find='find'
firstmakefile='makefile'
flex=''
fpostype='fpos64_t'
freetype='void'
full_csh='/usr/bin/csh'
full_sed='/usr/bin/sed'
gcc=''
gccversion=''
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 '
grep='grep'
groupcat=''
groupstype='gid_t'
h_fcntl='false'
h_sysfile='true'
hint='previous'
hostcat='ypcat hosts'
huge=''
i_bsdioctl=''
i_db='undef'
i_dbm='define'
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='define'
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='undef'
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='define'
i_unistd='define'
i_utime='define'
i_varargs='undef'
i_varhdr='stdarg.h'
i_vfork='undef'
incpath=''
inews=''
installarchlib='/usr/local/lib/perl5/aix/5.003'
installbin='/usr/local/bin'
installman1dir='/usr/local/man/man1'
installman3dir='/usr/local/lib/perl5/man/man3'
installprivlib='/usr/local/lib/perl5'
installscript='/usr/local/bin'
installsitearch='/usr/local/lib/perl5/site_perl/aix'
installsitelib='/usr/local/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='ld'
lddlflags='-H512 -T512 -bhalt:4 -bM:SRE -bI:$(PERL_INC)/perl.exp -bE:$(BASEEXT).exp -b noentry -lc -L/usr/local/lib'
ldflags=' -L/usr/local/lib'
less='less'
lib_ext='.a'
libc='/usr/lib/libc.a'
libpth='/usr/local/lib /lib /usr/lib /usr/ccs/lib'
libs='-ldbm -ldl -lld -lm -lc -lbsd -lPW'
libswanted='net socket inet nsl nm 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='/usr/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='off64_t'
mail=''
mailx=''
make=''
mallocobj=''
mallocsrc=''
malloctype='void *'
man1dir='/usr/local/man/man1'
man1direxp='/usr/local/man/man1'
man1ext='1'
man3dir='/usr/local/lib/perl5/man/man3'
man3direxp='/usr/local/lib/perl5/man/man3'
man3ext='3'
medium=''
mips=''
mips_type=''
mkdir='mkdir'
models='none'
modetype='mode_t'
more='more'
mv=''
myarchname='00080900A700-aix'
mydomain='.csci.csc.com'
myhostname='butch'
myuname='aix butch 2 4 00080900A700 '
n=''
nm_opt='-B'
nm_so_opt=''
nroff='nroff'
o_nonblock='O_NONBLOCK'
obj_ext='.o'
oldarchlib='/usr/local/lib/perl5/aix'
oldarchlibexp='/usr/local/lib/perl5/aix'
optimize='-O'
orderlib='false'
osname='aix'
osvers='4.2.0.0'
package='perl5'
pager='/usr/local/bin/less'
passcat=''
patchlevel='3'
path_sep=':'
perl='perl'
perladmin='bshair@butch.csci.csc.com'
perlpath='/usr/local/bin/perl'
pg='pg'
phostname='hostname'
plibpth=''
pmake=''
pr=''
prefix='/usr/local'
prefixexp='/usr/local'
privlib='/usr/local/lib/perl5'
privlibexp='/usr/local/lib/perl5'
prototype='define'
randbits='15'
ranlib=':'
rd_nodata='-1'
rm='rm'
rmail=''
runnm='true'
scriptdir='/usr/local/bin'
scriptdirexp='/usr/local/bin'
sed='sed'
selecttype='fd_set *'
sendmail='sendmail'
sh=''
shar=''
sharpbang='#!'
shmattype='void *'
shrpdir='none'
shsharp='true'
sig_name='ZERO HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM IOINT STOP TSTP CONT CHLD TTIN TTOU AIO XCPU XFSZ NUM26 MSG WINCH PWR USR1 USR2 PROF DANGER VTALRM MIGRATE PRE VIRT ALRM1 WAITING NUM40 NUM41 NUM42 NUM43 NUM44 NUM45 NUM46 NUM47 NUM48 NUM49 NUM50 NUM51 NUM52 NUM53 NUM54 NUM55 NUM56 NUM57 NUM58 NUM59 GRANT RETRACT SOUND MAX IOT LOST URG CLD IO POLL PTY KAP SAK '
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 6 6 16 20 23 23 23 60 63 '
signal_t='void'
sitearch='/usr/local/lib/perl5/site_perl/aix'
sitearchexp='/usr/local/lib/perl5/site_perl/aix'
sitelib='/usr/local/lib/perl5/site_perl'
sitelibexp='/usr/local/lib/perl5/site_perl'
sizetype='size_t'
sleep=''
smail=''
small=''
so='so'
sockethdr=''
socketlib=''
sort='sort'
spackage='Perl5'
spitshell='cat'
split=''
ssizetype='ssize_t'
startperl='#!/usr/local/bin/perl'
startsh='#!/bin/sh'
static_ext=' '
stdchar='unsigned 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/man/man1'
tail=''
tar=''
tbl=''
test='test'
timeincl='/usr/include/sys/time.h /usr/include/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
-- 
Bob Shair                          Open Systems Consultant
1018 W. Springfield Avenue         rmshair@uiuc.edu
Champaign, IL 61821		   217/356-2684
< Not employed by or representing the University of Illinois >


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

Date: 8 May 1997 16:22:41 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Drawing a graph?
Message-Id: <5ksukh$eg9@fridge-nf0.shore.net>

Michael Schuerig (uzs90z@uni-bonn.de) wrote:

: I'm looking for a module that draws a graph for me. I only want to input
: nodes (with labels) and edges (with labels) and have the module do
: everything else. Is there such a thing?

Yes.  Check CPAN for the Graph modules - I think there's one called GIFGraph
which might do what you want.

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: Thu, 08 May 1997 19:39:43 GMT
From: merick@xmission.com (Mont Erickson)
Subject: Re: Drawing a graph?
Message-Id: <5kt6mn$afk$2@news.xmission.com>

uzs90z@uni-bonn.de (Michael Schuerig) wrote:

>I'm looking for a module that draws a graph for me. I only want to input
>nodes (with labels) and edges (with labels) and have the module do
>everything else. Is there such a thing?

If you're looking to create .gif files (graphs) there are a couple of
things you can look at.  Check out the following:

	http://www-genome.wi.mit.edu/ftp/pub/software/WWW/GD.html
	...and...
	http://www.netexpress.net/~mkruse/perl/

Hope this helps.

P.S. -- If you can get this to compile on a UNIX system, let me know.



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

Date: Thu, 08 May 1997 10:55:18 -0600
From: Pat Thomson <pat@episun1.med.utah.edu>
Subject: Re: FTP support in perl
Message-Id: <33720576.B35@episun1.med.utah.edu>

A. Deckers wrote:
> 
> In comp.lang.perl.misc,
>         fritz@fuse.net wrote:
> >In a shell script I can do something like the following to FTP multiple
> >files from a machine:
> >
> >ftp myhost << !
> >userid
> >prompt
> >bin
> >get file01
> >get file02
> >!
> >
> >Can I do something similar form Perl, or do I need to get into sockets?
> 

yes

open(FTP, "ftp -in|");
print FTP "user me password\n";
print FTP "prompt\nbin\n";
print FTP "get file01\n";
close(FTP);

Pat Thomson


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

Date: Thu, 08 May 1997 11:09:27 -0600
From: Pat Thomson <pat@episun1.med.utah.edu>
Subject: Re: FTP support in perl
Message-Id: <337208C7.1B0E@episun1.med.utah.edu>

Pat Thomson wrote:

> yes
> 
> open(FTP, "ftp -in|");
> print FTP "user me password\n";
> print FTP "prompt\nbin\n";
> print FTP "get file01\n";
> close(FTP);
> 
OOPS mistake on my part the open command should read
open(FTP, "|ftp -in");

sorry
pat


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

Date: 08 May 1997 18:32:06 +0200
From: Gisle Aas <aas@bergen.sn.no>
Subject: Re: GIF in Base64 encoding?
Message-Id: <hyb9pzzzt.fsf@bergen.sn.no>

junkmail@sysc.abdn.ac.uk (Kyzer) writes:

> : I looked at MIME::Base64, but the pod says that the module is for encoding
> : strings (as opposed to images).  But, can I simply open() the GIF and use
> : this MIME::Base64 to encode the data I read after open()ing ?
> 
> Yes, I guess so!
> 
> The following test works fine (shows my horrible face!):
> cat kyzer.gif |\
> perl -p -mMIME::Base64 -e '$_=MIME::Base64::encode_base64($_)' |\

This may give you extra strange padding at places, because you encode
a line at a time.  You should preferably encode the whole image as a
single string.  I would do it like this:

  perl -MMIME::Base64 -e 'print encode_base64(`cat kyzer.gif`)'

-- 
Gisle Aas <aas@sn.no>


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

Date: Thu, 08 May 1997 18:46:44 -0700
From: Jan Krynicky <Jan.Krynicky@st.ms.mff.cuni.cz>
To: webmaster@rlws.com
Subject: Re: Help a Newbie (please)
Message-Id: <33728204.18A7@st.ms.mff.cuni.cz>

Eric A. Backlund wrote:
> 
> I am looking for script that will allow users to download a file to
> their disk, through a web page. The file has an .exe extentension, and
> when I create a link to the file, it load the text into the browser
> intstead of bringing up a Save As dialog box. Any help will be greatly
> appreciated.
> 
> Thanks,
> Eric
> --webmaster@rlws.com

Looks like improper setting. 

Go to explorer/View/Options/File Types/Programs(or something like that,
the type for .exe files)
and set the proper MIME type for .exe . (application/octet-stream)

I do not have access to any Win95/NT now, but this should do.

Jenda


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

Date: 08 May 1997 14:32:54 -0400
From: ldavis@reston.ans.net
Subject: HP OV SNMP Question
Message-Id: <rupvv1g6g9.fsf@reston.ans.net>

-----BEGIN PGP SIGNED MESSAGE-----

Does anyone have perl scripts that will convert a mib in
an rfc to a set of ObjStruct structures for use with the 
HP OpenView snmp api libraries?

- -Lynch
- -- 
____________________________________________________________________________

ANS CO+RE                                           Software Engineer
1875 Campus Commons Dr.                             ldavis@reston.ans.net
Suite 220,  Reston VA 22091                         (703) 758-6622
____________________________________________________________________________

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBM3IcVJJoCjbZ9+NBAQEsPgQAwSfEv6mw+OU80mRUSPxIOAYuMRTFy6Fa
uYbka7nFaOneBTehs3gXoHZOEv7KchUaG4gW7nQmVJVU+apC178TUPqiylzrd3Bv
YOiH11QlggWP6S0x78Ee1Rt/az/RFh87u96CpzYkzwglf1nHA4InyfVREd10DZ3i
GMbU23OE4vQ=
=tLwm
-----END PGP SIGNATURE-----


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

Date: Tue, 6 May 1997 14:42:55 GMT
From: "Erik D. Perkins" <Erik_Perkins@nt.com>
Subject: MacPerl question
Message-Id: <336F4367.6DB1@nt.com>

hello there,

being new to Perl, Macs, and MacPerl, here's a situation that has 
me stumped... i'm attempting to write a MacPerl script that takes 
a directory of aiff formatted sound files and plays them one at a
time through an application called SoundEdit.  even for a Perl
beginner, the user interface was easy to code (hit "n" for next, 
"p" for previous, "a" for again) but i can't figure out one part:  

how do i open an application from within MacPerl and feed it
(repeatedly) a whole file as its input?

in UNIX this script would be easy as SoundEdit would probably have
a command line input, but Macs drag-and-drop input (as well as the
syntax in MacPerl to make this happen) is a mystery to me.  i've
read much of the on-line docs about MacPerl but haven't had any
luck with helpful instruction or examples for this problem.

any help would be appreciated... please email Erik_Perkins@nt.com
with (helpful/non-abusive/non-pornographic) suggestions...

thanks,
erik


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

Date: Thu, 08 May 1997 13:22:18 -0400
From: Les Peters <lpeters@aol.net>
Subject: Re: Modifying D-Base fields with PERL.
Message-Id: <33720BCA.167E@aol.net>

Clay Irving wrote:
> 
> In <862862948.23367@dejanews.com> Jeremy_Fuller@rocketmail.com writes:
> >If you can, Please e-mail me at Jeremy_Fuller@rocketmail.com (I don't
> >check Usenet very often).
> 
> Shame on you.

Then I must be guilty of great laziness...I have hacked up a
Net::NNTP-based script that parses specific Usenet groups for a
regex, then mails me the article(s) that match (interested parties 
plz mail).

Thanks to Graham Barr for the TPJ #4 article (and the Net::* modules) in
giving this script its start, and to Jon Orwant for TPJ :)
-- 
Les Peters, IROps, DBA, AOL Networks
http://www.dba.aol.com/~lpeters/ or http://members.aol.com/lpeters/
<a href="http://www.lightlink.com/fors/">**Important**</a>


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

Date: 8 May 1997 16:53:19 GMT
From: prv@beaver.formalsys.ca (Paul Vermette)
Subject: ODBC Library for Perl & UNIX
Message-Id: <5kt0dv$o55$1@garnet.nbnet.nb.ca>

I am looking for a perl library that uses ODBC access for UNIX.. I have found one for Windows NT but this is no good for myself


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

Date: Thu, 08 May 1997 11:56:46 -0500
From: geordie@chapman.com (Geordie Korper)
Subject: Re: Perl for Dummies Book
Message-Id: <geordie-ya02408000R0805971156460001@kyrie>

In article <336A285F.1AB4@ainet.com>, jmscott@ainet.com wrote:

:I was at the local Barnes & Noble and saw a Perl for Dummies book on my
:way looking for something else.  I didn't recall seeing that book
:before, so I was wondering if this was a new one, and has anyone taken a
:look at it?
:        I'd like to think that after going through the two O'Reilly Perl books
:that I'd be more than a match for the Perl for Dummies book, but then
:again maybe not. :-) ( Don't get me wrong, the O'Rielly books were
:awesome, my hat's off the authors, I wouldn't trade those books for all
:the tea in... well you know how it goes.)


The nice thing about it is that it comes with a CD that contains the CPAN
library as of 12/96. For those of us with limited bandwidth. The CD in and
of itself is probably worth the price. It is also a fairly good book for a
gentle introduction to Perl but it won't get you as far as the camel.

-- 
Geordie Korper     geordie@chapman.com

*********************************************************************
* The text above should in no way be construed to represent the     *
* opinions  of my employer, even if specifically stated to do so.   *
*********************************************************************


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

Date: 08 May 1997 10:37:33 -0700
From: Russ Allbery <rra@stanford.edu>
To: Thomas Kipar <kipar@informatik.uni-bonn.de>
Subject: Re: Perl-Socket using in C ???
Message-Id: <m3vi4tg90i.fsf@windlord.Stanford.EDU>

[ Posted and mailed. ]

Thomas Kipar <kipar@informatik.uni-bonn.de> writes:

> How can I get an interger socket handle within a C program for a socket
> created in a perl script which calls this C program via 'system'?

You have to pass the file descriptor via a Unix domain socket, you're not
going to be able to use system() (you'll have to do the fork and exec
yourself), and it's decidedly non-trivial.

Pick up a copy of Stevens (_Advanced Unix Programming_) if you're going to
be doing things like this; it will explain how to do it.

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


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

Date: Thu, 8 May 1997 17:21:27 GMT
From: joel@wmi0.wmi.com (Joel Coltoff)
Subject: Re: program for perl?
Message-Id: <5kt220$o6g@netaxs.com>

In article <3371DF5A.3B4C@ballard.ca.boeing.com>,
Richard K. Downer <rkd7949@ballard.ca.boeing.com> wrote:
>No. Now how do I collect the $64000?


Do you really mean '$64000' or whatever the interpolation of
the variable is?

-- 
Joel Coltoff

I'd explain it, but there's a lot of math. -- Calvin


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

Date: 08 May 1997 14:23:31 -0400
From: Michael Mellinger <melling@panix2.panix.com>
Subject: quoting a separator for split()
Message-Id: <v5c207h6cws.fsf@panix2.panix.com>


I am maintaing a flat file DB with Perl and I am using split() to
extract the different fields.  However, the data is being entered by
many people who might type in my field separator in a couple of the
fields.  If a comment field were simply at the end, I could use the
limit operator, but a couple other fields might contain user entered
data.  Can I simply quote any separators so split won't parse a record
incorrectly?

#field1#This is #1#field3#field4#field5#Yikes, Houston we have a problem#!@#

split('#', $_, 6);

Perhaps there is a better way to maintain a flat file database in Perl?

-Mike



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

Date: Thu, 08 May 1997 19:35:34 GMT
From: merick@xmission.com (Mont Erickson)
Subject: Regular Expression/Associative Array Bug???
Message-Id: <5kt6ev$afk$1@news.xmission.com>

Can someone tell me if this is a bug in Perl5.002 or if this is
intentional?

Example 1 will produce multiple entries for the same key.

Example 1:
-----------------

open(FILE,"filename");

while(<FILE>) {
	/pattern(.+);/;
	$assoc_arr{$1} = 1;
}
close FILE;

for $idx (keys %assoc_arr) {
	printf "%5d %5d\n",$idx, $assoc_arr{$idx};
}

Example 2 will produce only one entry for each key.  Why is this???  I
would think both examples would produce the same results (one entry
per key).

Example 2:
-----------------

open(FILE,"filename");

while(<FILE>) {
	/pattern(d+);/;
	$assoc_arr{$1} = 1;
}
close FILE;

for $idx (keys %assoc_arr) {
	printf "%5d %5d\n",$idx, $assoc_arr{$idx};
}

P.S. --> The information buffered in $1 is always numbers in both
examples.  In other words, if you added the following 2 lines to
example one, directly after the regular expression, you will get the
same results as example 2:

  $tmp = int($1);
  $assoc_arr{$tmp};



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

Date: 8 May 1997 18:27:44 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: Require assistance with function stat
Message-Id: <5kt5v0$a4i$1@news.netusa.net>

Thomas Lachlan XMS x1893  <etltsln@etlxd30.ericsson.se> wrote:
>ood day everybody,
>		I'm using stat in a script I'm writing, however
>		due to extreme ignorance on my part I'm having difficulty
>		deciphering the significance of the 5 digit $mode field
>		returned by the afore mentioned function.

The mode is most interesting in octal. The last 12 bits of it have the
file permissions. In octal this is four digits, the same as the ones
you would use with chmod to set that mode. The rest of the field is the
file type. Read the stat(2) manpage for details.

Elijah
------
interpreting mode from stat in base 10 is a very common mistake


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

Date: Thu, 08 May 1997 19:53:58 +0100
From: Jong <jong@mrc-lmb.cam.ac.uk>
Subject: scrambling the elements of any array??
Message-Id: <33722146.41C6@mrc-lmb.cam.ac.uk>

Hi,

I have made a subroutine which does the job, but I 
am sure there are faster and different ways of
doing it. Can you think of the fastest way possible
in Perl

Thanks a lot,

Jong



#___________________________________________________________________
# Title     : scramble_array
# Usage     : @out=@{&scramble_array(\@in)}; 
# Function  :
#             outs line numbers with lines
# Example   :
# Warning   :
# Keywords  :
# Options   :
# Version   : 1.0
#---------------------------------------------------------------
sub scramble_array{
	srand(time()|$$);  # or use srand(time^$$);
	my ($i, $k, $len, $ran_pos, @scrambled_out_array, $ran_num, @random);

	for($i =0; $i< @_; $i++){
	   my @each_array = @{$_[$i]};
	   my $len=@each_array;

	   for($k=$len; $k > 0 ; $k--){
		  my $ran_pos = int(rand($k));
		  my $ran_num=splice(@each_array, $ran_pos, 1);
		  push(@random, $ran_num);
	   }
	   my $random=join("", @random);
	   push(@scrambled_out_array, $random);
	   undef(@random);
	}
	return(\@scrambled_out_array);
}




-- 
 I support Perl, Linux ...

With OVER SIX MILLION USERS, up from only ten or so a very few years
ago, Linux has taken it's place as the world's #3 computer operating
system overall. And Linux is breathing down the neck of #2 for very good
reasons. If growth rate to date continues, Linux will be the #1 computer
operating system by late '98 or '99. Are YOU ready?

	  ) Linux Newsletter

http://www.smli.com/people/john.ousterhout/scripting.html


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

Date: Thu, 08 May 97 18:07:25 GMT
From: jsheehy@trintech.com (John Sheehy)
Subject: Sending e-mail from within a perl script - help
Message-Id: <5kt52t$f8u$1@nuacht.iol.ie>

Hi,

I'm writing a simple perl script that generates a set of e-mail messages from 
an input file.

For each assembled message I call the routine SendMessage below.

For some unknown reason (at least to me) /bin/mail starts reading from 
standard input. This results in the script hanging and waiting for keyboard 
input. I have verified this by sending a message to myself. I also replaced 
/bin/mail with the cat command and watched the lines bounce back at me as I 
typed.

What am I doing wrong?

sub SendMessage
{
        open(MAILPIPE, "|/bin/mail -s \"Overdue Notification\" $_[0]" ) || die 
"
Can't open pipe to /bin/mail !\n";
        print MAILPIPE "\nOverdue item(s) :- \n\n";
        print MAILPIPE @Message;
        print MAILPIPE "\nPlease return at your earliest convenience.\n";
        close MAILPIPE;
}

Is there an alternative to this method? Perhaps
open(MAILPIPE, "|telnet mailhost 25");

Regards and thanks in advance for any help.
John.









John Sheehy - Systems Engineer                  
----------------------------------------------                 
Trintech (Manufacturing) Ltd

Telephone: +353 1 295 6766
Facsimile: +353 1 295 4735
WWW: http://www.trintech.com

The first riddle I ever heard, one familiar to almost every Jewish
child, was propounded to me by my father:
	"What is it that hangs on the wall, is green, wet -- and
whistles?"
	I knit my brow and thought and thought, and in final perplexity
gave up.
	"A herring," said my father.
	"A herring," I echoed.  "A herring doesn't hang on the wall!"
	"So hang it there."
	"But a herring isn't green!" I protested.
	"Paint it."
	"But a herring isn't wet."
	"If its just painted its still wet."
	"But -- " I sputtered, summoning all my outrage, "-- a herring
doesn't whistle!!"
	"Right, " smiled my father.  "I just put that in to make it
hard."
		-- Leo Rosten, "The Joys of Yiddish"

 



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

Date: Thu, 08 May 1997 19:03:59 -0700
From: Jan Krynicky <Jan.Krynicky@st.ms.mff.cuni.cz>
To: abennett@stonehill.edu
Subject: Re: Something I'm missing
Message-Id: <3372860F.4C9D@st.ms.mff.cuni.cz>

Aaron Bennett wrote:
> 
> I was hoping the program below would put <TR><TD></TR></TD> around every
> line that has
> no tab characters in it.  Instead is matches every line in the file.
> 
> The file is like this:
> 
> Summer Session I
> name {tab} year {tab} {tab} time {tab} {tab} etc
> 
> created by an person unskilled with word processing.  I have to HTML'ize
> it.
> 
> Instead of what I wanted, the program puts the characters around every
> line, tab or no tab.
> 
> Does anyone have any ideas?
> 
> Thanks.
> 
> #!/usr/local/bin/perl -w
> 
>         $file="evediv.txt";
>         $out="htmlout.html";
> 
> print "Opening $file for processing. \n";
> print "Results will be stored in $out. \n";
> 
> open (INPUT, $file) or die("Can't open $file!\n");
> open (OUTPUT, ">$out");
> 
> while ($textline=<INPUT>)       {
>         $textline =~ s/(.+\t{0}.+)/<TR><TD>$1<\/TD><\/TR>/sg;
                              ^^^
What did you mean by this. This should have mathed a line without a tab?

$textline = '<TR><TD>' . (chomp $textline) . '</TD></TR>\n' unless
$textline =~ /\t/;

It's longer but much more readable.


>         print OUTPUT $textline;
>         }
> 
> --
> |       Aaron Bennett

Hi, Jenda


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

Date: 8 May 1997 16:34:09 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: Something I'm missing
Message-Id: <5ksva1$p0@pirate.shu.edu>

Hello -

Aaron Bennett <abennett@stonehill.edu> writes:

>I was hoping the program below would put <TR><TD></TR></TD> around every
>line that has
>no tab characters in it.  Instead is matches every line in the file.

>The file is like this:

>Summer Session I
>name {tab} year {tab} {tab} time {tab} {tab} etc

 ....

>open (INPUT, $file) or die("Can't open $file!\n");
>open (OUTPUT, ">$out");

Check that one too :-)

>while ($textline=<INPUT>)	{
>	$textline =~ s/(.+\t{0}.+)/<TR><TD>$1<\/TD><\/TR>/sg; 
>	print OUTPUT $textline;
>	}

Your regex basically means: one or more characters, followed by
zero tabs, followed by one or more characters.  This will match
any line which has more than one character (including newline,
since you're using /s).

You probably want something like:  # untested code follows

while ($textline = <INPUT>) {
	next if ($textline =~ /\t/);      # skip lines with tabs
	next unless ($textline =~ /\w/);  # skip blank or all-space lines
	chomp $textline;
	print OUTPUT "<TR><TD>$textline<\/TD><\/TR>\n";
}

or

while... {
	next if ($textline =~ /\t/);
	$textline =~ s!(.+)!<TR><TD>$1</TD></TR>!;
	print OUTPUT $textline;
}

or

print OUTPUT map  { s!(.+)!<TR><TD>$1</TD></TR>!; $_ }
             grep { /\w/ && !/\t/ } <INPUT>;


or some subtle blend thereof.  


David Black
dblack@icarus.shu.edu


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

Date: 8 May 1997 17:10:59 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: Something I'm missing
Message-Id: <5kt1f3$40i@pirate.shu.edu>

Jan Krynicky <Jan.Krynicky@st.ms.mff.cuni.cz> writes:

>> while ($textline=<INPUT>)       {
>>         $textline =~ s/(.+\t{0}.+)/<TR><TD>$1<\/TD><\/TR>/sg;
>                              ^^^
>What did you mean by this. This should have mathed a line without a tab?

As indeed it will.  (See other posts for more.)

>$textline = '<TR><TD>' . (chomp $textline) . '</TD></TR>\n' unless
>$textline =~ /\t/;

>It's longer but much more readable.

But since chomp() returns the number of characters deleted, you're going
to end up with some pretty strange table data.

David Black
dblack@icarus.shu.edu


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

Date: 8 May 1997 18:15:24 GMT
From: I-hate-cyber-promo@man.ac.uk (A. Deckers)
Subject: STRAW POLL: RFD: comp.lang.perl reorg
Message-Id: <slrn5n461s.b90.I-hate-cyber-promo@news.rediris.es>

[NB: followup to poster]

In order to gage which groups would have a fighting chance of passing a
CFV vote, I would like to ask you to participate in an INFORMAL ballot.

This is NOT a vote to decide upon the creation of these groups, but a
non-binding consultation to assist the proponents in deciding which
groups should be included in the official RFD. Vote on the proposed
group names and subject areas ONLY. At this stage, I'm not interested
whether or not you agree with the moderation provisions of the charter.

Please take into account that the script that will process your vote is
a quick hack I've just thrown together in a few minutes. It is not very
sophisticated, and will not deal with blank or erroneous ballots
particularly graciously. It will however send you an acknowldgement
including what it thinks your vote was, so if you think there was an
error somewhere, vote again, using the same From and Reply-To addresses
(the script prefers the Reply-To address over the from).

Whatever else you do, PLEASE include the words "straw poll" (case is
not significant; the quotes don't matter) in the subject header, since
that's how my email filtering software will pick out ballots and pipe
them to the script.

Do NOT publish your vote in the group; send it to me by EMAIL.

The ballot will close on Saturday, 10th of May sometime in the morning
(as soon as I'm awake enough to logon).

Now for the vote: please fill in either YES or NO in the space provided
below. Your vote MUST be between the square brackets.  Don't alter the
line in any other way. You may add a quote mark at the beginning of the
line, but if you use some silly quoting mechanism that will make the
lines wrap, please edit them manually so they don't.

I vote [     ] to comp.lang.perl.data-structure
I vote [     ] to comp.lang.perl.inter-process
I vote [     ] to comp.lang.perl.programmer
I vote [     ] to comp.lang.perl.regex

If you would like to suggest any alternative/additional groups, please
complete the group name below (one group per line). If you don't,
please delete the following line altogether.

I vote [ YES ] to comp.lang.perl.

Don't bother voting for comp.lang.perl.{cgi,www,wizards,guru,etc.}
since I will not include any such thing in the official RFD. I am
confident that all the proponents share this position.

I repeat that if the vote ack you receive from the script doesn't
correspond to your vote, vote again using the same address. If all
else fails (and I see no reason why it should), mail me your vote
without the words "straw poll" in the subject, and I'll process it
manually.

Multiple votes will only be counted once, so Netscape users can breathe
easy. Hit that send button as many times as you want. :-)

NB: the dodgy looking address in the headers is perfectly good. Please
use it.

Cheers,

Alain

-- 
Perl information: <URL:http://www.perl.com/perl/>
        Perl FAQ: <URL:http://www.perl.com/perl/faq/>
    Perl archive: <URL:http://www.perl.com/CPAN/>


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

Date: 8 May 1997 18:52:00 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: Trash can or wastebasket for Unix
Message-Id: <5kt7cg$bi5$1@news.netusa.net>

Jason Kohles <robobob@xmission.xmission.com> wrote:
>tfbiv@erols.com (Tom Bates) writes:
>>I've been looking for a trashcan or wastebasket type of program for
>>use on a Sun workstation network.  Being a new fan of perl, I thought
>>I might write one in perl, but I wanted to see if it had been done
>>already.  Has it?

Ugh. Not this again. This is probably in the comp.unix.shell FAQ. It
should be at least. Can't you just do something like aliasing rm to
"rm -i"?

>It has now...
>
>alias rm 'cp \!* ~/.wastebasket'
>alias emptywastebasket '/usr/bin/rm -rf ~/.wastebasket/*'

Is this supposed to work? I see no way that will delete anything. The
ones built around "mv" are better. You also have a serious problem
that if ~/.wastebasket does not exist, is not a symlink pointing to
a directory, or a directory the `rm' will clobber whatever is there
and the `emptywastebasket' will not delete anything. Further problem
with that is rm belongs in /bin/, not /usr/bin/. It is sometimes
there, but you should never count on it being there.

Another problem is that real trashcan implementations can deal with
multiple files of the same name whereas such things are tough to do
in csh's aliases. (Csh has powerful aliases, yes, but they are broken
and stupid compared to the strength of shell functions.) Yet another
thing real trashcan implementations do is keep the file on the same
filesystem by having the trashcan simultaneously represent directories
on multiple filesystems. This is a very much against the grain of
Unix filesystems. With a mv based rm alias you run the risk of filling
a disk. If you do so as root on a filesystem that likes some free
space (the traditional BSD filesystem comes to mind) you can seriously
hose your disk performance. I have seen quota systems that would
cause this "failsafe" to break down and fail. 

If you really want a trashcan get yourself a Netapp toaster with it's
on-line backup system. Should help you deal with clobbers and unwanted
editing as well, something no trashcan could do. And that is a Unix-y
way to solve the problem. (<URL:http://www.netapp.com/>)

Elijah
------
this is not a problem perl will help you with


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

Date: 8 May 1997 10:21:39 -0700
From: trs@azstarnet.com (Tim  Smith)
Subject: using CGI::Request w/o CGI::Carp
Message-Id: <5kt233$jtk@web.azstarnet.com>

Hello.  The web server I'm stuck with directs STDERR to the browser,
not to the error log.  I'd like to use CGI::Request without using
CGI::Carp, so that I have more control over error messages.  I've
tried removing the 'use CGI::Carp' lines from CGI/{Base,Request}.pm,
but CGI::Carp is still being slurped in somewhere.  I'd rather do it
from inside my program, if it's possible.

Also, with -w I get a warning when compiling:

web:~/public_html/sn$ perl5 -c mldriver.cgi 
Subroutine confess redefined at /usr/local/lib/perl5/site_perl/CGI/Carp.pm\
line 176.
Subroutine croak redefined at /usr/local/lib/perl5/site_perl/CGI/Carp.pm\
line 177.
Subroutine carp redefined at /usr/local/lib/perl5/site_perl/CGI/Carp.pm\
line 178.
mldriver.cgi syntax OK

Since STDERR goes to the browser, this results in a ServerError.  Any help
for either of these questions is most appreciated!

Thanks,

Tim


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

Date: Thu, 08 May 1997 19:50:01 -0700
From: Jan Krynicky <Jan.Krynicky@st.ms.mff.cuni.cz>
To: eglamkowski@hotmail.com.OBLIGATORY.ANTI.SPAM.FILTER
Subject: Re: variable  names
Message-Id: <337290D9.1B29@st.ms.mff.cuni.cz>

the count wrote:
> 
> it is possible to create variable names on the fly?
> for example, i want a series of variables a1, a2, a3... up to aX where
> X is a user defined variable.
> i.e. is there any way concatenate together two or more variables
> to create a new variable name?
> 
> i'd like to be able to do something like:
> for ($i = 1; $i <= $X; $i++) {
>   $a."$i" = some_expression;

    ${'a' . $i} = some_expression;

> }
> 
> and end up with:
> $a1 = something
> $a2 = something_else
> $a3 = something_else_yet_again
> etc.
> 
> is this legal?  if not, is there any other way to do this?
> 
> --

Hi, Jenda


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

Date: 08 May 1997 10:42:26 -0700
From: Russ Allbery <rra@stanford.edu>
To: eglamkowski@hotmail.com.OBLIGATORY.ANTI.SPAM.FILTER
Subject: Re: variable  names
Message-Id: <m3rafhg8sd.fsf@windlord.Stanford.EDU>

[ Posted and mailed. ]

the count <eglamkowski@hotmail.com> writes:

> it is possible to create variable names on the fly?  for example, i want
> a series of variables a1, a2, a3... up to aX where X is a user defined
> variable.

Yes, it's called a symbolic reference.  See man perlref.

     People frequently expect it to work like this.  So it does.

         $name = "foo";
         $$name = 1;                 # Sets $foo
         ${$name} = 2;               # Sets $foo
         ${$name x 2} = 3;           # Sets $foofoo
         $name->[0] = 4;             # Sets $foo[0]
         @$name = ();                # Clears @foo
         &$name();                   # Calls &foo() (as in Perl 4)
         $pack = "THAT";
         ${"${pack}::$name"} = 5;    # Sets $THAT::foo without eval

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


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

Date: 8 May 1997 16:49:19 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: variable names
Message-Id: <5kt06f$1vm@pirate.shu.edu>

Hello -

the count <eglamkowski@hotmail.com> writes:

>it is possible to create variable names on the fly?
>for example, i want a series of variables a1, a2, a3... up to aX where
>X is a user defined variable.
>i.e. is there any way concatenate together two or more variables 
>to create a new variable name?

>i'd like to be able to do something like:
>for ($i = 1; $i <= $X; $i++) {
>  $a."$i" = some_expression;
>}

>and end up with:
>$a1 = something
>$a2 = something_else
>$a3 = something_else_yet_again
>etc.

>is this legal?  if not, is there any other way to do this?

You mean any illegal way? :-)

What you want are symbolic references.

$i = 3;
${"a$i"} = "whatever\n";
print $a3;  # watch the magic!

See man perlref.

David Black
dblack@icarus.shu.edu
--
>-- 
>   "The gods themselves struggle in vain against stupidity." - Schiller

"'Symbolic references' reminds me of 'Elective Affinities'.  I'm suing."
  - Goethe


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

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

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