[7133] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 758 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 23 18:07:13 1997

Date: Wed, 23 Jul 97 15:00:27 -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           Wed, 23 Jul 1997     Volume: 8 Number: 758

Today's topics:
     Re: ?? mail bouncer (Nathan V. Patwardhan)
     Re: cgi, server side include help (Erik Braun)
     generate e-mail with MIME .dat file (Ariel Y Fishman)
     Help! How do I execute as another in perl? (James S White)
     HELP: Innocuous return stmt yields errors <tbrannon@nunki.usc.edu>
     Re: how to do system(@array) with backticks (Andreas Karrer)
     Re: how to reverse substitution order ? <merlyn@stonehenge.com>
     improvement for h2ph... (Robert L. Urban)
     Re: Integer arrays in an XS extension.. <erik@scandinaviaonline.se>
     Re: Last US business date in Perl? <dres@dimensional.com>
     Linking perl5 for PowerPC running NT4 <bbarnes@rsperfa.austin.ibm.com>
     Re: National Medal of Technology: Let's nominate Larry! (Dan Carson)
     Re: newsgroup archives? (A. Deckers)
     Re: Parsing boolean logic and converting to SQL? (Jason E Holt)
     Perl 5.004 Install Problem <rajamani@ee.tamu.edu>
     Re: Perl for Informix <sfairey@adc.metrica.co.uk>
     perl in NT anu.hariharan@compaq.com
     Perl print buffer. <blue145@u.washington.edu>
     perl's sense of humor (Jeff Stampes)
     Problems Installing Libnet Bundle <Unix> (Paul Berry)
     Q: efficient way tu use sub arrays (repost) <klausf@mucsun.sps.mot.com>
     Re: Q: empty elements in arrays <clark@s3i.com>
     rlogin with Perl <bethazzi@ncsa.uiuc.edu>
     Re: Syntax junkies ! (Brian Wheeler)
     Re: Trimming leading and trailing spaces. (Brian - DKOnline)
     Re: Using varaibles from a template file <rootbeer@teleport.com>
     WEB ARCHITECT <recruiter@lds.com>
     Re: where to go for html and SSI questions (Bob Wilkinson)
     Re: writing to multiple files on login (A. Deckers)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 22 Jul 1997 18:24:22 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: ?? mail bouncer
Message-Id: <5r2tsm$o55@fridge-nf0.shore.net>

Alex Matthews (alex@darkfire.com) wrote:
: Could anyone make any suggestions where I might find or maybe go about
: writing a perl script that bounces incoming mail to my virtual domain if
: the To: header does not contain my preferred email address(es).

Sure.

1) Read STDIN into an array (or however you want to hold the contents
   of STDIN)
2) Grab the To: line of the mail message.  If it's cool, open the file
   where you want to put the email message and exit.  If it's not
   cool, remail the contents of the message.  You could always use
   a Mail (or MIME::Head) module to parse the contents of the header.
3) Test the script from the command-line with some email messages.  If
   it works, put the scriptname and | into your .forward file.

Don't forget to use flock on the file you're writing to.

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: 22 Jul 1997 12:57:46 GMT
From: erik@paxp01.mipool.uni-jena.de (Erik Braun)
Subject: Re: cgi, server side include help
Message-Id: <slrn5t9bi9.idk.erik@paxp01.mipool.uni-jena.de>

On Sun, 20 Jul 1997 20:50:24 -0700, Raj Kumar <rajk@best.com> wrote:

>I have renamed my html file to index.shtml
>and then I put the following in my file:
>
><!-- #config timefmt = "%I:%M:%S" -->
     ^
     !

Remove this space. (and please ask the next time in an appropriate newsgroup,
your question has no relation to Perl)

erik
-- 
erik@minet.uni-jena.de


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

Date: 21 Jul 1997 23:57:21 GMT
From: ayfishma@mail2.sas.upenn.edu (Ariel Y Fishman)
Subject: generate e-mail with MIME .dat file
Message-Id: <5r0t11$e9r@netnews.upenn.edu>

Greetings! I am trying to write a CGI perl script that will turn form 
submissions into an e-mail with a MIME attachment containing the form 
data as a tab-delimited spreadsheet. I'm not having much luck, however. 
I've been trying just to generate the e-mail in a perl script, send it 
using sendmail, and make it look like there is an attachment present, but 
it doesn't seem to work (it reads the e-mail message literally, and not 
as an attachment.)

Can someone suggest a way either to do what I'm doing above, or a 
different way (i.e. instead of sendmail with another program?). Also, are 
my carriage returns/newlines in the right place?

Thanks in advance,

Ariel

What my script looks like:
-----
#normal headers...
#from post submission
#some copied from _CGI Book_ by Weinman

$cl = $ENV{"CONTENT_LENGTH"};

read(STDIN, $qs, $cl);

#split stdin up into an array by the ampersand
@qs = split(/&/,$qs);

foreach $i (0 .. $#qs)
  {
  # split each into name and value
  ($name, $value) = split(/=/,$qs[$i],2);

  # create the associative element
  $qs{$name} = $value;
  }

print "Content-type: text/html\n\n";
# this is what the viewer will see on an htmlpage
# not the crucial element right now
print qq(
Have a nice day.<p>
 ..rest snipped..
);

open(MAIL, "| /usr/lib/sendmail -t -f'sendersaddress\@here'");

#Does this particularly matter? 
$boundary = "--=====================_869512345==_";

print(MAIL "To: $myaddress\r\n");
print(MAIL "From: Data auto-submission <sendersaddress\@here>\r\n");
print(MAIL "Subject: Data submission\r\n");
print(MAIL "Mime-Version: 1.0\r\n");
print(MAIL "Content-Type: multipart/mixed; boundary=\"$boundary\"\r\n\r\n");

print(MAIL "$boundary\n");
print(MAIL "Content-Type: TEXT/PLAIN; charset=US-ASCII\n");

print MAIL qq(
Message from:
Remote Host: $ENV{"REMOTE_HOST"}
Remote Addr: $ENV{"REMOTE_ADDR"}
User Agent:  $ENV{"HTTP_USER_AGENT"}
and other text
);
print(MAIL "$boundary\n");
print(MAIL 'Content-Type: text/plain; charset="iso-8859-1"'."\n");
print(MAIL "Content-Transfer-Encoding: quoted-printable\n");
print(MAIL "Content-Disposition: attachment; filename=\"filename.dat\"\n\n");

# printing the contents
foreach $name (keys(%qs))
	{ print MAIL "$name=\n\t"; }
print(MAIL "finaldum\n");
foreach $name (keys(%qs))
	{ print MAIL "$qs{$name}=\n\t"; }
print(MAIL "end\n\n");
print(MAIL "$boundary\n");

close(MAIL);

#end

-----------------------------
Ariel Fishman           fishman@pobox.com


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

Date: 23 Jul 1997 14:26:44 GMT
From: whitej4@vetmed.auburn.edu (James S White)
Subject: Help! How do I execute as another in perl?
Message-Id: <5r54b4$obt@ultranews.duc.auburn.edu>

I need to know how to make perl execute a script (as in a system call) as someone other than the one running the perl program. I'm pretty sure it can be done, I just dont know how.
Thanks in advance!

--
James S. White    whitej4@vetmed.auburn.edu    www.vetmed.auburn.edu/~whitej4
------------------------------------------------------------------------------
Give a man a fish and he eats for one meal.
Teach a man to fish and he eats for a lifetime.



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

Date: 22 Jul 1997 09:58:31 -0700
From: tbrannon <tbrannon@nunki.usc.edu>
Subject: HELP: Innocuous return stmt yields errors
Message-Id: <ysiz90yzqb11.fsf@nunki.usc.edu>

sub count_spikes {
    my ($spike_ct,$i);
    $spike_ct = 0;
    for ($i=0; $i< nelem($Persync::current_piddle); ++$i) {
	if spike_at($i) {
	    ++$spike_ct;
	}
    }
    return($spike_ct);
}

yields the following errs:

 DB<2> use Persync
Global symbol "spike_ct" requires explicit package name at /felix/terry/scripts/perl/Persync.pm line 204, <IN> chunk 2.
	require Persync.pm called at (eval 5) line 2
	main::BEGIN called at /felix/terry/scripts/perl/Persync.pm line 204
	eval {...} called at /felix/terry/scripts/perl/Persync.pm line 204
	eval '($@, $!, $,, $/, $\\, $^W) = @saved;package main; $^D = $^D | $DB::db_stop;
use Persync;

;' called at /usr/lib/perl5/perl5db.pl line 926
	DB::eval called at /usr/lib/perl5/perl5db.pl line 848
	DB::DB called at -e line 1
syntax error at /felix/terry/scripts/perl/Persync.pm line 205, near "}"
BEGIN failed--compilation aborted at (eval 5) line 2, <IN> chunk 2.

  DB<3> 
-- 
o============o  Sending unsolicited commercial e-mail (UCE)  to this address
 Legal Notice   is indication of your consent to pay me $120/hour for 1 hour
o============o  minimum for professional proofreading & technical assessment.
  Terrence Brannon * brannon@quake.usc.edu * http://quake.usc.edu/~brannon


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

Date: 22 Jul 1997 15:33:51 GMT
From: karrer@ife.ee.ethz.ch (Andreas Karrer)
Subject: Re: how to do system(@array) with backticks
Message-Id: <slrn5t9kn3.5k5.karrer@kuru.ee.ethz.ch>

In article <33D49944.C72BA9DE@adc.metrica.co.uk>, Simon Fairey wrote:
>Marek Rouchal HL CAD SYS Tel. 25849 wrote:
>
>> I'd like to execute a command (e.g. `date') without invoking an extra
>> shell AND
>> capture the standard output.
>>
>
>  How about opening a pipe as follows:
>
>open DATE, "date|";
>while(<DATE>){
>        chomp;
>        print "\nCmd returned:<$_>";
>}
>close DATE;

Nice idea, buggy implementation.

   open CMD, "@cmd|"

interpolates @cmd before open sees it, and runs a subshell. You want

   open CMD, "-|" or exec @cmd;

as described under "open" in the perlfunc man page or one of the more
eleborate constructs described under "Safe Pipe Opens" in the perlipc
man page.

 - Andi


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

Date: 23 Jul 1997 09:56:54 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: mike@stok.co.uk (Mike Stok)
Subject: Re: how to reverse substitution order ?
Message-Id: <8ck9ihvh9l.fsf@gadget.cscaper.com>

>>>>> "Mike" == Mike Stok <mike@stok.co.uk> writes:

Mike>     1 while $chemin =~ s:[^/]+/\.\./::;

And of course, as Tom Phoenix already explained, that's broken
if $chemin has any symlinks in the path.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 404 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: 22 Jul 1997 17:28:39 GMT
From: urban@nasaxp.rto.dec.com (Robert L. Urban)
Subject: improvement for h2ph...
Message-Id: <5r2qk7$6e3$1@rtnews.rto.dec.com>

Hi folks,

On Digital UNIX, there are all sort of constants in the include
files such as

	123.456e123
	123.456e-123
	123.456e123f

	12345678ul
	12345678UL

and h2ph was choking on them.  If you change (from the 5.004_01 release)
h2ph, line 163 from
	 s/^(0x[0-9a-fA-F]+)//   && do {$new .= $1; next;};
to
	s/^(0x[0-9a-fA-F]+)[lLuU]*//    && do {$new .= $1; next;};
and add
	s/^([+-]?\d+\.\d+[eE][+-]?\d+)[fF]?//   && do {$new .= $1; next;};
right after it, you'll get much better results.

for diff fans: (diff h2ph.old h2ph.new)
163c163,164
<       s/^(0x[0-9a-fA-F]+)//   && do {$new .= $1; next;};
---
>       s/^(0x[0-9a-fA-F]+)[lLuU]*//    && do {$new .= $1; next;};
>       s/^([+-]?\d+\.\d+[eE][+-]?\d+)[fF]?//   && do {$new .= $1; next;};


also,  in order to get "require 'sys/ioctl.ph';" working, I had to edit
sys/signal.ph:

look for a couple of blocks like:
            eval 'sub SIG_ERR () {( &void (*))-1;}';
            eval 'sub SIG_DFL () {( &void (*))0;}';
            eval 'sub SIG_IGN () {( &void (*))1;}';
            eval 'sub SIG_HOLD () {( &void (*))2;}';
            eval 'sub SIG_CATCH () {( &void (*))3;}';

and change to:
            eval 'sub SIG_ERR () {-1;}';

(for example).

rob urban

-- 
Rob Urban
Digital Equipment GmbH
Freischuetzstr. 91
81927 Muenchen
Germany


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

Date: 22 Jul 1997 22:12:24 +0200
From: Erik Assum <erik@scandinaviaonline.se>
Subject: Re: Integer arrays in an XS extension..
Message-Id: <uo7mei7snr.fsf@absolut.scandinaviaonline.se>

[ Marius Kjeldahl ]

| Could somebody give me a hint what kind of types I need to define in
| typemap, and the necessary routines for translating the data back and
| forth in perl?

You might want to take a look at

http://www.cs.utah.edu/~beazley/SWIG/

Erik.


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

Date: 23 Jul 1997 14:53:54 -0600
From: James LewisMoss <dres@dimensional.com>
Subject: Re: Last US business date in Perl?
Message-Id: <hh67u1zdzx.fsf@dres.elam.org>

>>>>> On Thu, 17 Jul 1997 00:12:21 -0600, treed@cpr.com said:

 treed> Hi, I need to determine whether a particular date was a US
 treed> business day.  I also need to determine the last 5 US business
 treed> dates.  Does anyone know of a Perl package that can help?

look at the Date::Manip package in CPAN.  It does business days,
parses dates (like "today" or "last sunday"), and it'll do relative
date ("today", "-1 week"; etc)

HTH
Jim

-- 
@James LewisMoss <dres@dimensional.com> |  Blessed Be!
@    http://www.dimensional.com/~dres   |  Linux is cool!
@"Argue for your limitations and sure enough, they're yours." Bach


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

Date: Tue, 22 Jul 1997 11:12:13 -0500
From: "Brian P. Barnes" <bbarnes@rsperfa.austin.ibm.com>
Subject: Linking perl5 for PowerPC running NT4
Message-Id: <33D4DBDD.794B@rsperfa.austin.ibm.com>

Hi,

I have a PowerPC running NT 4.0 and am getting a linker error when I do
a `nmake` in the perl5.004_01\win32 directory:
link.exe fatal error LNK1112 module machine type "PPC" conflicts with
target machine type "IX86".

Has anyone successfully built perl on this platform?

Thanks,

	Brian


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

Date: 22 Jul 1997 08:25:53 -0700
From: dbc@tc.fluke.com (Dan Carson)
Subject: Re: National Medal of Technology: Let's nominate Larry!
Message-Id: <5r2je1$g6s$1@chelan.tc.fluke.com>


I think it would be more appropriate for Larry to receive the Nobel prize.
Both Nobel and Wall created tools of great utility (dynamite and perl),
and both were dismayed that their creations weren't always used for the
good of mankind (blowing up people and e-mailing 100,000 people how to
"MAKE CA$H FA$T!!!!!!!!!").

Besides, I think perl is dynamite!
(or is that dy-no-mite?)

Dan Carson


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

Date: 23 Jul 1997 16:57:33 GMT
From: I-hate-cyber-promo@man.ac.uk (A. Deckers)
Subject: Re: newsgroup archives?
Message-Id: <slrn5tcdvs.f3f.I-hate-cyber-promo@news.rediris.es>

(note followup)

In <33D4F068.41C67EA6@127.0.0.1>,
	Murray Stokely <murray@cdrom.com> wrote:
>Are any of the perl newsgroups archived on any public ftp sites?  I
>would like to get the last 400 megs of posts or so but I cannot find any
>public sites that are archiving this group.  Please respond by email if
>possible, or I might miss your reply.
>-- 
>Murray Stokely (murray-at-cdrom.com)

All Big 8 newsgroups (comp.*, humanities.*, misc.*, news.*, sci.*,
soc.*, sci.* and talk.*) plus a buch of others are archived at the
following sites:

<URL:http://www.dejanews.com/>
<URL:http://www.reference.com/>

comp.lang.perl.announce is archived on CPAN, though I can't remember
the exact place at the moment.

HTH,

Alain

-- 
Perl information: <URL:http://www.perl.com/perl/>
    Perl archive: <URL:http://www.perl.com/CPAN/>
        Perl FAQ: <URL:http://www.perl.com/CPAN/doc/FAQs/FAQ/>
>>>>>>>>>>>>> NB: comp.lang.perl.misc is NOT a CGI group <<<<<<<<<<<<<<


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

Date: 22 Jul 1997 01:29:55 GMT
From: holt@puree.cs.byu.edu (Jason E Holt)
Subject: Re: Parsing boolean logic and converting to SQL?
Message-Id: <5r12ej$gss@hamblin.math.byu.edu>

Antti Tuominen (d74403@majakka.uwasa.fi) wrote:
: I'm doing a database query www interface with perl and need to be able
: to process boolean queries like: "NOT L=a AND ( A=b OR A=c )", where L
: and A are fields in the database. I need to parse this query string
: and convert it to a SQL query.

: I was wondering if someone had done something even remotely similar
: and could give me some hints or even some code to do this. I figure
: that every search engine supporting boolean queries must do this sort
: of thing and if someone has already done this there's no use for me
: to reinvent the wheel.

: Please, email me any thoughts about this. Thanks!

	The formal approach would be to write a more-or-less complete
interpreter for your query language which spits out SQL.  This isn't
as hard as it sounds (although it is nontrivial).  You'd need to write
a simple tokenizer to break up the queries, and a parser to grok the
structure.  The parser would then generate the SQL.  If you can come up
with a BNF for your queries, I have a script which will parse the BNF
and generate a parser for you.  Then you just plug in the SQL code for
the appropriate grammar productions.  (Yacc probably does a much better
job of this.  I don't know.  I couldn't use Yacc when I wrote the script,
and I never bothered to read up on it.)

	My scripts (with no warranty express or implied, and rather
customized for the class I wrote them for) can be found at:

http://students.cs.byu.edu/~holt/bnf.zip

	And may at least provide some amusement.  Actually, rather than
using the scripts to generate a parser, you may just want to modify the
scripts to parse queries instead of parsing BNFs, and generate SQL
instead of code.

				-J




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

Date: Tue, 22 Jul 1997 14:54:57 -0500
From: Shashidhar Rajamani <rajamani@ee.tamu.edu>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Perl 5.004 Install Problem
Message-Id: <Pine.SOL.3.96.970722131139.12411B-100000@eesun3.tamu.edu>

	I am unable to install 5.004_01 on solaris 2.5.1
	I get the following error when running make test:

make: Warning: Both `makefile' and `Makefile' exist
rm -f libperl.a
ar rcu libperl.a perl.o malloc.o gv.o toke.o perly.o op.o regcomp.o
dump.o
util.o mg.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o
doop.o doio.o regexec.o taint.o deb.o universal.o globals.o perlio.o 
sh: ar: not found
*** Error code 1
make: Fatal error: Command failed for target `libperl.a'

	I am actually using a compiler from another machine (through
auto mount). 
	The following are the configuration options used :
Platform:,
osname='solaris',osvers='2.5.1',,
archname='sun4-solaris',
myuname='sunos himalaya 5.5.1 generic sun4m sparc sunw,sparcstation-10 ',
hint='recommended', d_sigaction='undef', useposix=true, bincompat3='y',
useperlio='undef', usesfio='false', d_sfio='undef'
Compiler:
cc='cc', cccdlflags='', ccdlflags='', ccflags='', d_stdstdio='define',
intsize='4', ld='ld', ldflags='', timeincl='/usr/include/sys/time.h ',
db_prefixtype='size_t', libc='/mach5/opt/SUNWspro/lib/libcx.so.1',
libperl='libperl.a', libpth='/mach5/opt/SUNWspro/lib', libs='-lm',
libswanted='sfio net socket inet nsl nm ndbm gdbm dbm db dl dld sun m c
            cposix posix ndir dir crypt bsd BSD PW x',
dlext='none', dlsrc='dl_none.xs'

Appreciate your help,
Thank you,
shashi.





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

Date: Wed, 23 Jul 1997 12:07:08 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: Wei Tang <wtang@cs.ualberta.ca>
Subject: Re: Perl for Informix
Message-Id: <33D5E5DA.6411C83A@adc.metrica.co.uk>

Wei Tang wrote:

> Hi, there:
>
> Is there any facility of Perl to access Informix database like Oraperl
>
> for Oracle database?
>
> Thanks.

   Look at the DBD and DBI modules at your local CPAN you should find
what you need there, although last I heard the database interface was
going through an overhaul.

Simon



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

Date: Tue, 22 Jul 1997 11:12:00 -0600
From: anu.hariharan@compaq.com
Subject: perl in NT
Message-Id: <869585979.13343@dejanews.com>

Hello,

I am using Microsoft FrontPage to create a web site and am using
Netscape
for viewing the page. I am trying to process a form with a CGI script
written in perl. I am on NT, so the perl script has extension .bat.
But when I submit the form, it gets executed as a .bat file does on
the
DOS prompt. Can someone please tell me how I can get this executed as
a
perl script ? What paths etc. do I need to specify ?

Thanks
Anu

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


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

Date: Tue, 22 Jul 1997 10:51:55 -0700
From: David Adams <blue145@u.washington.edu>
Subject: Perl print buffer.
Message-Id: <Pine.SUN.3.93.970722104726.12548B-100000@psts.mbt.washington.edu>


Hi comp.lang.perl.misc,

I skimmed the FAQ and didn't see any discussion of what is
a significant perl-related problem for me. Please excuse the
verbosity of the question and setup. The general problem is that
unless I terminate a line of printed text with "\n", I get
extremely varied output from my perl print and concatenation
constructs. 

For example, I am currently writing a one-use script to change a
file in one format:

	color:    red
	size:     large
	number:   1

	color:    orange
	size:     medium
	number:   2

into another format:

	1, red, large
	2, orange, medium

etc.

I am loading the first file into an array of hashes (which seems to be
working fine), but when I try to print I get bizarre behavior. 

In the following example, @records is an array of hashes,  and
@order is an array of hash keys (in the order I want them printed).

open(OUT,">out");
for($i=1;$i<$#records;$i++) {
    for($keynum=0;$keynum<$#order;$keynum++) {
        if( defined( $records[$i]{$order[$keynum]} ) ){
            push @array, $records[$i]{$order[$keynum]};
        }else{
            push @array, "";
        }
    }
    $ps = join(',',@array);
    print OUT $ps,"\n";
    undef(@array);
    undef($ps);
}
close(OUT);

This code (I know, it's not beautiful) prints out some thing like

	,,edarge
	,rangium

instead of what it is supposed to print out ("1, red, large" etc.).

If, instead, I use

open(OUT,">out");
for($i=1;$i<$#records;$i++) {
    for($keynum=0;$keynum<$#order;$keynum++) {
        if( defined( $records[$i]{$order[$keynum]} ) ){
            push @array, $records[$i]{$order[$keynum]};
        }else{
            push @array, "";
        }
    }
    foreach $item (@array) {print OUT $item,"\n";}
}
close(OUT);

I get

	1
	red
	large
	2
	orange
	medium

I have tried "join", ".=", "x = x . y" and many other constructs with 
slightly varying, but essentially the same results. I am running perl5
on a Sun0S 4.3.1 box. I would love any suggestions concerning:

	1.) this specific code example, and
	2.) pushing print "buffer" output to the screen
	without sending a newline character.

Thank you in advance!!

					-David Adams

P.S. Please cc to dradams@psts.mbt.washington.edu, thanks!


_______________________________________________________________________
Web Page: http://psts.mbt.washington.edu/davepage.html
	This is the basic scientific question: Which phenomena are the 
	way they are due to chance, and which are the way they are 
	because they couldn't be any other way.  -Timothy Ferris
_______________________________________________________________________



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

Date: 22 Jul 1997 16:40:56 GMT
From: stampes@xilinx.com (Jeff Stampes)
Subject: perl's sense of humor
Message-Id: <5r2nqo$7qa$1@neocad.com>

Just messing around, my funny bone was tickled by this:

main'(/tmp/perl-ea23506:1):	1
  DB<1> $foo = 20000000000

  DB<2> print $foo+$foo
40000000000
  DB<3> print $foo*$foo
4e+20
  DB<4> print $foo**$foo
Infinity
  DB<5> q


I was amused anyway....

--
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com


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

Date: Wed, 23 Jul 1997 12:49:15 -0400
From: pwlberry@nortel.ca (Paul Berry)
Subject: Problems Installing Libnet Bundle <Unix>
Message-Id: <pwlberry-2307971249150001@47.169.41.144>

After typing the "perl Makefile.PL" command the following error is displayed.

Can't locate IO/File.pm in @INC at Makefile.PL line 70.
BEGIN failed--compilation aborted at Makefile.PL line 70.

My understanding is that Libnet requires Data::Dumper and IO::Socket to be
installed as well.  I've installed Data::Dumper with no problems.  I also
have the understanding that IO::Socket comes bundled with Perl.  However I
cannot find IO::Socket anywhere on the system nor can my Unix Sys.
Admin..  Therefore I'm assuming it is already installed?

Any help would be appreciated.

Paul


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

Date: Wed, 23 Jul 1997 12:48:19 +0200
From: Klaus Foerster <klausf@mucsun.sps.mot.com>
Subject: Q: efficient way tu use sub arrays (repost)
Message-Id: <33D5E173.4041@mucsun.sps.mot.com>

Hi folks,

Sorry I screwed up the subject line of my first post.
So here again.

The camel book (perl 4) says its more efficient to use

foreach (@array){
  PROCESS $_;
}

than doing

for($i=0;$i<@array;$i++){
  PROCESS($array[$i]);
}

I have an array containing about 1 million text lines (The machine has 
enough RAM for that).

I have to process certain subsections of this array.

Is there a faster way to process sections of an array 
(example: elements 200,000 - 800,00) 

or do I have to do this with a for loop.

The other thing i have to do is
searching a set of about 20 regular expressions within a
sub array. Again I'd like to know the fastest way.

The set of regular expressions is stored in an array @expr and can
change during runtime.


Any help is appreciated.

ThanX in advance


bye


Klaus


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

Date: 23 Jul 1997 16:30:08 -0400
From: Clark Dorman <clark@s3i.com>
Subject: Re: Q: empty elements in arrays
Message-Id: <d3ep5h5pr.fsf@s3i.com>


Uwe Lammers <Uwe.Lammers@astro.estec.esa.nl> writes:
> looking for the most efficient way to determine whether a string array
> contains empty entries, i.e.,
> 
> ('1', '2', '3') -> no
> ('1', '2', '', '3') -> yes
> 
> one ugly, non-fail-safe way would be
> 
> if (join("@", @list) !~ /\@\@|^\@|\@$/) {
>     print "no ";
> }
> print "empty elements\n";

Use a foreach list.  Break out if you hit an empty:

#!/home/dorman/bin/perl -w

@alist1 = ('1', '2', '3');
@alist2 = ('1', '2', '', '3');

$blank_or_not = &findblanks( @alist1 );
print " $blank_or_not \n";
$blank_or_not = &findblanks( @alist2 );
print " $blank_or_not \n";

sub findblanks {
   my( @lst ) = @_;
   foreach (@lst) {
      print("Found an empty\n"), return(1) if (/^$/);
   }
   print "No empties \n";
   return(0);
}


WARNING WARNING WARNING:  watch out for things like:

      print("Found an empty\n"), return(1) if (/^$/);

If you really want it to print, do not do

      print "Found an empty\n", return(1) if (/^$/);

because that dog don't hunt.

-- 
Clark Dorman				"Evolution is cleverer than you are."
http://cns-web.bu.edu/pub/dorman/D.html                -Francis Crick


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

Date: Tue, 22 Jul 1997 12:55:11 -0500
From: Beth Azzi <bethazzi@ncsa.uiuc.edu>
Subject: rlogin with Perl
Message-Id: <33D4F3EC.4ECA@ncsa.uiuc.edu>

Hello,

I need to write a script to log into 30 different accounts and do
something to all of them.  The password for all 30 accounts is the
same.  At the beginning of the script, the password will be entered by
STDIN.

After the script issues the system call to rlogin, how can I make the
script enter the password ($password) automatically?  e.g.
system ('rlogin - | $login');
???   # enter password

Any help would be appreciated.

Thanks!
Beth Azzi


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

Date: 22 Jul 1997 16:51:56 GMT
From: bdwheele@indiana.edu (Brian Wheeler)
Subject: Re: Syntax junkies !
Message-Id: <5r2ofc$msd$1@dismay.ucs.indiana.edu>

In article <01bc96bb$e03742e0$0422989e@allied.demon.co.uk>,
	"Bruce Davidson" <allied@pair.com> writes:
>hi,
>this kindly donated from this group.
>My choice of opening and closing handles.
>
>#!/usr/bin/perl
>
>{
>open (SOURCE,"/mydir/file1.html");
>open (DESTINATION, ">/mydir/file2.html");
>while (<SOURCE>) {
>	print DESTINATION $_;
>	}
>close (SOURCE);
>close (DESTINATION);
>}
># end of file
>
>Purpose - to use a browser to copy one file over another at the server. Why
>- who cares :)

	Better be careful that it can only copy what you want it to copy...
otherwise, you could be opening a major security hole.

>
>Works on telnet login with free bsd C shell in cgi-bin using "perl
>script.pl".
>My other small scripts  just need  "script.pl" to operate. 
>Don't understand why this needs the "perl" prefix.

	Is perl where you think it is?

>
>I'd like to call this from my browser links, but when I try, the server
>reports an error
>so I don't even get as far as when on telnet.

	You're not sending back an appropriate MIME header.  CGI is more than
just placing it into cgi-bin.


>I'd also like the browser to print NEWFILE = OK chum, we overwrote file 2
>with file 1.
>Syntax needed.

	Learn how to use CGI (lots of info on the net).  To see if you are
going to overwrite a file, use the "-e filename" file test to see if it
exists.

>
>Any folks got a steer on this please.
>Could it be file permissions on the server.
>The script is chmod 755.
>thanks
>BD
>allied@pair.com

-- 
Brian Wheeler
bdwheele@indiana.edu


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

Date: Tue, 22 Jul 1997 13:28:51 GMT
From: Brian@dkonline.com (Brian - DKOnline)
Subject: Re: Trimming leading and trailing spaces.
Message-Id: <33d7b540.5234536@pub.news.uk.psi.net>

On Wed, 16 Jul 1997 22:44:31 -0700, Tom Phoenix
<rootbeer@teleport.com> wrote:

>On Wed, 16 Jul 1997, rkn wrote:
>
>> Is there a simole way to trim leading and trailing spaces?
>
>Yes, and it's in the FAQ. Hope this helps!
>
>-- 
>Tom Phoenix           http://www.teleport.com/~rootbeer/
>rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
>Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
>

What a waste of bandwidth!
If you can't be helpful, don't post!

Here's the expression:
s/^\s//g;
s/\s$//g;




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

Date: Wed, 23 Jul 1997 10:12:06 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Andrew Dear <dear_andrew@jpmorgan.com>
Subject: Re: Using varaibles from a template file
Message-Id: <Pine.GSO.3.96.970723100726.23677C-100000@kelly.teleport.com>

On Wed, 23 Jul 1997, Andrew Dear wrote:

> I want to do the same thing as you have answered here, except
> my file might read:
> 
> 	My name is $Const::names{'me'}
> 
> instead of 
> 
> 	My name is $my_name
> 
> ie. instead of a variable in the file (eg. $name) I have
> a hash declared in another package (eg. $Const::names{'me'})
> 
> Try as might I can't change the regular expression and get it
> to match correctly.

Actually, this general problem (matching any possible Perl scalar
variable) can't be done with a single regular expression, although this
particular case could be managed. In any case, it's probably easier to use
something like Text::Template, which is available on CPAN. (If you use
that, the file format would need to be different, but that shouldn't be a
problem.) Hope this helps!

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



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

Date: Tue, 22 Jul 1997 16:05:57 -0400
From: Recruiter <recruiter@lds.com>
Subject: WEB ARCHITECT
Message-Id: <33D512A5.3851@lds.com>

Logical Design Solutions, a leader in the design and development of
Interactive Business Communications has an immediate full-time opening
in their Morristown, NJ office for a Web Architect.

Job Description:
In this visible role, the ideal candidate will possess experience in
configuration of Internet technologies as part of a multi-tiered     
information technology architecture.  Keeping up-to-date with
current technology trends is essential, as is the ability to evaluate
appropriate technology components for development and delivery
environments.  This individual must also have the ability to integrate
application support technologies with preexisting client IT 
infrastructure.  Experience with C/C++, Perl, HTML, Java, CGI and
knowledge of Internet protocols and standards is required.  
Knowledge of Active X a plus.

Contact:

Technical Recruiter
Logical Design Solutions
Phone: (201) 971-0100
Fax:   (201) 971-0103
email: recruiter@lds.com

For further info:   http://www.lds.com


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

Date: Wed, 23 Jul 1997 14:52:09 +0100
From: b.wilkinson@pindar.co.uk (Bob Wilkinson)
Subject: Re: where to go for html and SSI questions
Message-Id: <b.wilkinson-2307971452090001@ip57-york.pindar.co.uk>

In article <33D54583.1D7A4BBA@best.com>, Raj Kumar <rajk@best.com> wrote:

> Hello
> 
> I was wondering what is the right newsgroup to go to
> for html and server side include questions.
> 
> Suggestions please.
> 
> 
> -Raj

Try comp.infosystems.www.authoring.cgi (if you are discussing the cgi interface)

Bob

-- 
 .sig file on holiday


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

Date: 23 Jul 1997 20:58:36 GMT
From: I-hate-cyber-promo@man.ac.uk (A. Deckers)
Subject: Re: writing to multiple files on login
Message-Id: <slrn5tcs3q.nhn.I-hate-cyber-promo@news.rediris.es>

In <33D696B7.1FBB@prism.gatech.edu>,
	Jodi Shephard <gt1295b@prism.gatech.edu> wrote:
>I have a registration script that writes the user login name and
>password to a file.  This part works fine. If the user id is the same as
>another registration is not permited. This part works fine.  If
>registration is permitted I want to also write to another file based on
>the variable $id.  So each user has their own separate file named
>'user_id'.txt.  Does anyone have any suggestion how to do this?

open FILE, ">$id.txt" or die "can't write $id.txt: $!\n";
# put something in "$id.txt"
close FILE;

Like that?

HTH,

Alain

-- 
Perl information: <URL:http://www.perl.com/perl/>
    Perl archive: <URL:http://www.perl.com/CPAN/>
        Perl FAQ: <URL:http://www.perl.com/CPAN/doc/FAQs/FAQ/>
>>>>>>>>>>>>> NB: comp.lang.perl.misc is NOT a CGI group <<<<<<<<<<<<<<


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

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

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