[6605] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 230 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 3 22:07:22 1997

Date: Thu, 3 Apr 97 19:00:25 -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           Thu, 3 Apr 1997     Volume: 8 Number: 230

Today's topics:
     A sendmail e-mail with carriage returns <dbaker@dkburnap.com>
     Re: Arithmetic expressions?? <bill@stygian.com>
     Re: Arithmetic expressions?? <vladimir@cs.ualberta.ca>
     Re: Arithmetic expressions?? (Tad McClellan)
     Attaching a message through mail with Perl (Aegir)
     Re: Attaching a message through mail with Perl <eryq@enteract.com>
     Configuring Perl5.002 on OS2 (Dan Ascheman)
     Error msg for mkdir <jeffe@FL.ENSCO.COM>
     Re: HELP with perl array <danboo@ixl.com>
     Help! --simple $ problem <dean_suko@opcode.com>
     How to tell if a file exists? (I hate spam!)
     Re: How to tell if a file exists? (Nathan V. Patwardhan)
     Re: How to tell if a file exists? (Tad McClellan)
     Is this a bug??? posix_types.ph (Klaus Mueller)
     Re: LDAP and Perl (Duncan Harris)
     Re: New Microsoft Perl Product (fwd) <martin@visual-dreams.demon.co.uk>
     Re: New Microsoft Perl Product (fwd) (Eric Bohlman)
     Re: New white paper on scripting <tchrist@mox.perl.com>
     Re: newbie -- can I do this w/Macperl? (Paul J. Schinder)
     Re: Perl and VMS (Jonathan Hudson)
     perl data structure for a data table with dictionary (Michael Friendly)
     Process Communication <dsonak@us.oracle.com>
     Re: Processing lists. <dbenhur@egames.com>
     Re: Requesting help for idiotic (?) problem .. sigh. <Konstantin.Avdeev@p474.f474.n5030.z2.fidonet.org>
     Re: Running program on a remote machine <mtw@eng.sun.com>
     Re: Simple array question by newbie... <qdtcall@k2.kiere.ericsson.se>
     Re: The theoretically fastest way to iterate through al <dbenhur@egames.com>
     Re: Using Perl with MS-Access <dbaker@dkburnap.com>
     Virtual FTP. <dflash@netcomuk.co.uk>
     Re: Virtual FTP. (Nathan V. Patwardhan)
     Re: Who makes more $$ - Windows vs. Unix programmers? <rmarkle@earthlink.net>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 2 Apr 1997 21:13:28 GMT
From: "David Baker" <dbaker@dkburnap.com>
Subject: A sendmail e-mail with carriage returns
Message-Id: <01bc3faa$b09e8420$c7a3bece@micronclientpro.dkburnap.com>

I need to send an e-mail with carriage returns.  I tried "...\r\n"; but the
end user said it didn't have the carriage return in the formatted e-mail. 
They get the newline stuff, but no carriage return.

When I try "\r"; sendmail wont work.  It needs the \n coupled to work.

Am I doing something wrong or the recipient of the e-mail doing something
wrong?

Thanks,

David


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

Date: 4 Apr 1997 00:08:16 GMT
From: "Bill Brunning" <bill@stygian.com>
Subject: Re: Arithmetic expressions??
Message-Id: <01bc408c$8d134260$68a6bacd@stygian>

Ken Anderson <anderson@necsys.gsfc.nasa.gov> wrote in article
<y7x912zx05e.fsf@necsys.gsfc.nasa.gov>...

> i have 3 file tests to see if there are a sequential set
> of files present, i.e. file($n-1),file$n,file($n+1).
> The problem is pretty much exactly shown: i can't seem
> to get perl to evaluate the arithmetic expressions within
> the filetest. in other words, this won't work:
> 
> 
> -e "file"$n+1 ...       # barfs
> -e "file"($n+1) ...	# barfs
> -e file$n+1 ...		# barfs
> -e "file$n+1"	...	# of course, barfs
> 
> (by barfing i mean it doesn't eval the $n+1)

Ken:

     -e "file" . ($n + 1)

 .... should work barflessly.

HTH.

Bill Brunning
bill@stygian.com


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

Date: 03 Apr 1997 17:40:06 -0700
From: Vladimir Alexiev <vladimir@cs.ualberta.ca>
To: Ken Anderson <anderson@necsys.gsfc.nasa.gov>
Subject: Re: Arithmetic expressions??
Message-Id: <omohbvhb8a.fsf@tees.cs.ualberta.ca>

In article <y7x912zx05e.fsf@necsys.gsfc.nasa.gov> Ken Anderson <anderson@necsys.gsfc.nasa.gov> writes:

> -e "file"$n+1 ...       # barfs
> -e "file"($n+1) ...	# barfs
> -e file$n+1 ...		# barfs
> -e "file$n+1"	...	# of course, barfs

Try -e 'file'.($n+1):

$ touch t1 t2
$ perl
$n=1;
print -e 't'.$n,'|', -e 't'.($n+1);
^D
1|1

Perl interpolates inside "strings" only $vars, such as "file$n".
If you want more complex expressions, use catenation `.'
Unless you want to use abominations such as "file@{[$n+2]}" which creates a
[in-line reference] to a singleton array, then @{dereferences it}.


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

Date: Thu, 3 Apr 1997 16:42:45 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Arithmetic expressions??
Message-Id: <5pb1i5.di1.ln@localhost>

Ken Anderson (anderson@necsys.gsfc.nasa.gov) wrote:

: 'nother question that i can't seem to find an answer to
: in my book (the camel one):

: i have 3 file tests to see if there are a sequential set
: of files present, i.e. file($n-1),file$n,file($n+1).
: The problem is pretty much exactly shown: i can't seem
: to get perl to evaluate the arithmetic expressions within
: the filetest. in other words, this won't work:


: -e "file"$n+1 ...       # barfs
: -e "file"($n+1) ...	# barfs
: -e file$n+1 ...		# barfs
: -e "file$n+1"	...	# of course, barfs

: (by barfing i mean it doesn't eval the $n+1)
: What i am looking for a ksh-like ability to evaluate the
: arithmetic expression on the fly. 

: eg.	in ksh one could do this

: 	if [[ -a file$(($n + 1)) ]]  

: i have tried using eval { }
: but it is more trouble than simply doing this:

: $f1=$n+1; -e $f1 ...

: From a previous discussion in this group, i have developed the
: feeling that once Perl has decided on a context, you're stuck.

No context problems here.


: is there a trick??

No trick.

Just ask perl to do the Right Thing and, most of the time, it does  ;-)


if (-e "file" . ($n+1)) {print "matched\n"}


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


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

Date: Fri, 04 Apr 1997 02:28:31 +0200
From: ByeBye@mail.dma.be (Aegir)
Subject: Attaching a message through mail with Perl
Message-Id: <ByeBye-ya02408000R0404970228310001@news.ping.be>

Polite question. Help appreciated.

What's the exact command/way with perl to send a file with help of the mail
program. (e.g. UNIX Mail)

Thank you,

-- 
Aegir@mail.dma.be
( ! My default reply email address is changed to fool spambots. Use the one
here above)


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

Date: Thu, 03 Apr 1997 19:27:42 -0600
From: Eryq <eryq@enteract.com>
To: Aegir <aegir@mail.dma.be>
Subject: Re: Attaching a message through mail with Perl
Message-Id: <3344590E.4DE3C914@enteract.com>

Aegir wrote:
> 
> Polite question. Help appreciated.
> 
> What's the exact command/way with perl to send a file with help of the mail
> program. (e.g. UNIX Mail)
> 
> Thank you,
> 

If you want to do what I think you want to do (send possibly-non-text
documents through email, or possibly send messages with one or more "attachments",
then...

Get a copy of the new (Alpha-release, but pretty stable) MIME::Lite module, either
from the CPAN authors/Eryq directory, or directly from:

        http://enteract.com/~eryq/CPAN/MIME-Lite/

Documentation also online, at:

        http://enteract.com/~eryq/CPAN/MIME-Lite/docs/MIME/

You can do attachments, the files can be really long, you can output
the MIME to a string, or a filehandle, and you can even send the message
(on Unix).  Hope that helps!

-- 
  ___  _ _ _   _  ___ _   Eryq (eryq@enteract.com)
 / _ \| '_| | | |/ _ ' /  Hughes STX, NASA/Goddard Space Flight Cntr.
|  __/| | | |_| | |_| |   http://www.enteract.com/~eryq
 \___||_|  \__, |\__, |___/\  Visit STREETWISE, Chicago's newspaper by/
           |___/    |______/ of the homeless: http://www.streetwise.org


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

Date: 3 Apr 1997 22:32:48 GMT
From: asched1@medtronic.COM (Dan Ascheman)
Subject: Configuring Perl5.002 on OS2
Message-Id: <5i1b6g$s7$1@gazette.corp.medtronic.com>

Hi all,
 I am stuck in the middle of running my Configure script on OS2 which
created my config,sh file.  The problem is, it says it can't find awk and
tells me to check my path - I have awk in my path, I have awk in my current
working dir., and I even tell the path in Configure where Awk is - What
more do I have to do??

Any help is appreciated,
Dan

--
Dan Ascheman
@medtronic.com
instruments  phone: x4880  Mail Stop: T426


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

Date: Thu, 3 Apr 1997 21:56:36 GMT
From: Jeff Etrick <jeffe@FL.ENSCO.COM>
Subject: Error msg for mkdir
Message-Id: <33442794.446B@FL.ENSCO.COM>

I wanted to check the status of the mkdir myself, but when I use
the call "mkpath" as soon as it hits a directory it can not make it
aborts.

Is there a method that will simply return the number of directories
created and not abort when it can't create one?

In my example below I would like to do the checking myself and the
output
would tell the user which directory could not be created.

Example code:

#!/usr/tools/gnu/bin/perl

use File::Path;

my $test = ["/home/jeff/RAMS/DUCKS/"];

my $verboseFlag = 0;

my $permissionMode = 0770; # owner and group rwx

my $count =  mkpath($test, $verboseFlag, $permissionMode);

print "Count is $count\n";

if (-e $test[1]) {
  print("Can't create file\n");
}

OUTPUT:

mkdir /home/jeff: Permission denied at tmp.pl line 11

-- 
------------------------------------------------------------------------
Jeffery R. Etrick    NET  : jeffe@FL.ENSCO.COM
ENSCO INC.           MAIL : 445 Pineda Ct.  Melbourne, Fl.  32940-7506
                     PHONE: 407-254-4122
------------------------------------------------------------------------


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

Date: Thu, 03 Apr 1997 17:09:59 -0500
From: Dan Boorstein <danboo@ixl.com>
To: anna <anna@water.ca.gov>
Subject: Re: HELP with perl array
Message-Id: <33442AB7.2ED8@ixl.com>

anna wrote:
> 
> Hi,
> I was wondering if you could help me.
> 
> I have a large flatfile which I can open in perl.  I would like to set up
> the data in an array, so I can search the data.  The file has many
> lines.  Each line has 5 elements separated by tabs.  I would like to
> search for a particular value in element 2 and then if the value of
> element 2 is the right one, perform a calculation on element 4.
> 
> The data file has the following format:
> B12345  10/01/95        00:00   2.56    85
> B12345  10/01/95        12:00   4.32    85
> B12345  10/05/95        00:00   5.96    85
> B12345  10/05/95        12:00   3.16    85
> 
> My attempt at building an array doesn't produce the right results.
> Rather than printing  a singular value, it prints all the values for
> element 4.  See code below.
> 
> I would appreciate any help you can offer.
> 
> Thanks in advance,
> Anna
> 
> anna@water.ca.gov
> 
> _____
> 
> #!/usr/local/bin/perl
> $infile = B12345.txt
> open(DATA,"$infile") || die "Can't open data file. \n";
> @lines = <DATA>;
> close(DATA);
> foreach $line (@lines) {
>   ($id, $date, $time, $cost, $code) = split(/\t/, $line);
>         print $calc;
> }

I would do something akin to the following:

step through one line at a time
if your target date is found between tabs 1 and 2
  grab the text between tabs 3 and 4
  do something with the grabbed text

#!/usr/local/bin/perl
$infile = B12345.txt
open(DATA,"$infile") || die "Can't open data file. \n";
$searchdate = '10/05/95';
while (<DATA>) {
  if (m|^.+?\t$searchdate\t.+?\t(.+?)\t|) { 
    $cost = $1;                             
    &DoSomething($cost);                    
  }
}


Dan Boorstein
danboo@ixl.com


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

Date: Thu, 03 Apr 1997 18:08:53 +0000
From: Dean Suko <dean_suko@opcode.com>
Subject: Help! --simple $ problem
Message-Id: <3343F225.646B@opcode.com>

Can someone help me with this easy question:

How can I delete a number of elements within a string and return the
"post-deleted" data back into the string?

For example, lets say I have this string defined:

$bob = "hello I am bob"

I want to hack the first 3 elements and put the remainder back into a
string. Thus my final string would contain only:

"lo I am bob"

The number of elements I would want to delete would change, which is
why  it's specified as a number.

Can anyone give me a hand? 
Sorry for the simplistic question.

Thanks in advance.

:-)


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

Date: 3 Apr 1997 22:56:42 GMT
From: alweiner@clark.net.com (I hate spam!)
Subject: How to tell if a file exists?
Message-Id: <5i1cja$o3a@clarknet.clark.net>

Is there a way (other than open) to tell whether or not a file exists?
-- 
----
To reply to this message, please remove the last 4 characters from the 
email address...



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

Date: 3 Apr 1997 23:35:41 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: How to tell if a file exists?
Message-Id: <5i1esd$hhf@fridge-nf0.shore.net>

I hate spam! (alweiner@clark.net.com) wrote:
: Is there a way (other than open) to tell whether or not a file exists?

Did you try -e ?  stat()?  The manpages?  POD?  The Black Market Perl Guy?

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: Thu, 3 Apr 1997 20:08:59 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: How to tell if a file exists?
Message-Id: <rrn1i5.v92.ln@localhost>

I hate spam! (alweiner@clark.net.com) wrote:


: Is there a way (other than open) to tell whether or not a file exists?
                                                            ^^^^^^^^^^

Yes.

grep -i 'file exist' *.pod

Will show you the answer...



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


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

Date: 04 Apr 1997 00:14:07 +0100
From: klaus@klaus.privat.de (Klaus Mueller)
Subject: Is this a bug??? posix_types.ph
Message-Id: <ubu7v3dj4.fsf@ntzeus.klaus.privat.de>

Hello,

I use Perl 5.003 with a Linux system. There is a problem with the
posix_types.ph file. This file contains original the following line:

	eval 'sub NULL {(( &void *)  0);}';

The perl interpreter say the folowing error:

Number found where operator expected at (eval 164) line 1, near ") 0"
        eval 'sub NULL {(( &void *) 0);}

If I change the line to the following, the interpreter say nothing:

	eval 'sub NULL {(( &void *) = 0);}';

My question:

Is this a bug and is my changed line correct.

Please help me quickly.

Thanks

Klaus
-- 
~/.signature


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

Date: 3 Apr 1997 23:09:18 GMT
From: duncan@sapio.co.uk (Duncan Harris)
Subject: Re: LDAP and Perl
Message-Id: <memo.970403230858.113C@sapio.compulink.co.uk>

In article <memo.970402234226.128E@sapio.compulink.co.uk>, 
duncan@sapio.co.uk (Duncan Harris) wrote:

> Is anybody doing anything with LDAP and Perl?
> 
> Perhaps an LDAP addon module, or native LDAP from Perl?


It seems I should have looked on dejanews first. This was discussed a 
month or so ago. Sorry.

--
Duncan Harris, Sapio Design Ltd, Manchester, U.K.
~~~~~~~~~~~ mailto:duncan@sapio.co.uk ~~~~~~~~~~~
Web on CD-ROM?  Check out http://www.sapio.co.uk/


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

Date: Thu, 03 Apr 1997 23:18:41 GMT
From: "Martin Moore" <martin@visual-dreams.demon.co.uk>
Subject: Re: New Microsoft Perl Product (fwd)
Message-Id: <01bc4085$509b14e0$0100000a@visual-dreams.demon.co.uk>

Alan Bostick <abostick@netcom.com> wrote in article
<dOTQz8m9LomZ085yn@netcom.com>...
> The following showed up in my mailbox.  I thought I'd share it with
> everyone.
> 
> > MICROSOFT VISUAL PERL++ ADDS ENORMOUS POWER AND EASE OF USE TO A
> > PROGRAMMING FAVORITE.

[Various, very funny lines omitted]

Oh dear.... My Boss read this one, passed it to me and ACTUALLY told me to
see if we
can put an order in for this... He also wanted to enquire if it will be
part of the Internet Development
suite M$ are releasing...

Should I tell him, or just tell him he would be better following it up? ;)

-]M[ (I wanted UNIX, my boss gave me M$ :(    - I think I'll quit next week)


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

Date: Fri, 4 Apr 1997 01:26:14 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: New Microsoft Perl Product (fwd)
Message-Id: <ebohlmanE83Anr.293@netcom.com>

Alan Bostick (abostick@netcom.com) wrote:
: The following showed up in my mailbox.  I thought I'd share it with
: everyone.

: > MICROSOFT VISUAL PERL++ ADDS ENORMOUS POWER AND EASE OF USE TO A
: > PROGRAMMING FAVORITE.

The April Fools nature of the "announcement" was transparent from the 
beginning.  If Microsoft were really releasing such a product, they'd 
have called it "Visual P++".



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

Date: 3 Apr 1997 22:37:53 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: New white paper on scripting
Message-Id: <5i1bg1$83n$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.python, jim@ks.uiuc.edu (Jim Phillips) writes:
:John Ousterhout <ouster@tcl.Eng.Sun.COM> wrote:
:>"Scripting: Higher-Level Programming for the 21st Century".
:>	http://www.sunlabs.com/tcl

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

:This was an interesting paper, and I agreed with a lot of the comments on the 
:advantages of scripting languages.  I do, however, feel that the bashing of 
:object-oriented programming was unjustified for two reasons:
:
:1) False separation of "scripting" or "typeless" languages from 
:object-oriented languages.  Objective-C and Python both use a single type for 
:objects and do run-time member lookup allowing any object which can handle 
:the necessary calls to be used with any package.  

(As does Perl, Tom notes tactlessly.)

To me, the whole notion that there exist two kinds of languages:

	TYPE A		TYPE B

    scripting		system
    interpreted	      	compiled
    typeless		strongly-typed
    glue		components
    string-based	object-oriented
    rapid-development	product-oriented deliverables

is a facile oversimplification loaded with false dualism.  Reality would
seem to be that items in those columns float freely back and forth
depending on many factors, and pretending that they are two sides of a coin
ignores many shades of grey as well as unrelated orthogonal axes.   

Cannot compiled languages glue things together?  Cannot interpeted
languages be used for systems programming (think of BASIC-PLUS and RSTS/E
for a non-Unix example)?  Is there some reason why interpreters should
not have objects, or compilers dynamic/fluid types?  I can compile awk
or Perl into C, and thence to assembler and machine language.  Or I can
run C or Pascal in an interpreted environment.  Does that all of a sudden
change what they are?

I don't think so.

Many of the other points are valid, but it just seems too much a case
of black and white.  

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    Some are born to perl, some achieve perl, and some have perl
    thrust upon them.  


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

Date: Thu, 03 Apr 1997 19:37:00 -0500
From: schinder@leprss.gsfc.nasa.gov (Paul J. Schinder)
Subject: Re: newbie -- can I do this w/Macperl?
Message-Id: <schinder-0304971937010001@schinder.clark.net>

In article <5i0nu2$p7m@lastactionhero.rs.itd.umich.edu>, nynaeve@umich.edu
(Elizabeth C. Bodenmiller) wrote:

}  First of all -- I apologize profusely for my previous empty message -- I
}  was looking for my text editor in the wrong place.  Now, for my plea for
}  help:
}  --------------
}  I know next to nothing about perl or applescript, but I need to figure 
}  out whether I can use one or both of them to create web pages on-the-fly 
}  from FileMaker and ProCite databases.  

You mean a CGI to do this?

}  
}  Can anyone tell me if:
}  
}  1)  this is possible?

They're all computer languages, so it's certainly possible.  The question
is whether it's possible in a reasonable amount of time.

}   
}  2)  there are examples of such code/scripting somewhere that I can 
}  basically steal?
}  
}  I've been looking through a perl book, but having only basic (Hello 
}  World-type) programming skills, I can't figure out where to even look.

The place to look is certainly not Applescript.  MacPerl is a great port
of Perl, but it's limited as a CGI language, basically because you can't
fork() on a Mac and MacPerl is single threaded.  (Applescript's
limitations in this regard are far worse.)  Figuring out how to
communicate with FileMaker and/or ProCite will also be a problem.

What you want to do, if this is *only* going to be run on a Macintosh, is
to learn Frontier.  That is the language of choice for CGI programming
using WebSTAR or another Mac HTTP server, because it's multi-threaded and
communicates with Macintosh applications as well as Applescript does.  You
can find out more at <http://www.scripting.com/frontier/>  Frontier itself
is freeware.  The learning curve will be similar to MacPerl's.  The great
disadvantage of Frontier is that it's not multi-platform, but that isn't a
problem if you're only running on Macs.  Frontier's users have done a lot
of work in Web site administration and dynamic Web sites, so it's possible
you'll find exactly what you want already written.


}  
}  Thank you.
}  
}  Elizabeth Bodenmiller
}  -----------------------------------------------------------------------------
}  "I'm just like any modern woman, trying to have it all: a loving husband,
}  a family....It's just I wish I had more time to seek out the dark forces
}  and join their hellish crusade...."                    -- Morticia Addams
} 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
}  http://www.si.umich.edu/~nynaeve                        nynaeve@umich.edu

-- 
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693, Greenbelt, MD 20771
schinder@leprss.gsfc.nasa.gov


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

Date: 3 Apr 1997 17:56:20 GMT
From: Jonathan.Hudson@jrhudson.demon.co.uk (Jonathan Hudson)
To: Frank Backes <100121.2745@CompuServe.COM>
Subject: Re: Perl and VMS
Message-Id: <5i0r04$li@trespassersW.local>

In article <5hvnjo$po4$1@mhafc.production.compuserve.com>,
	Frank Backes <100121.2745@CompuServe.COM> writes:
>Is there anybody out there
>who got Perl running on a Vax ?

>Any hint where I can find sources that compile on a DEC-Alpha 

[mailed, posted]

Yes, at least on Alpha/DECC. Just download the latest sources from
CPAN and follow the instructions. Some basic editing of the socket
files may be needed depending on the IP stack you wish to use, and
there are a few places where you may (depending on the DECC version)
need to disable some compiler warning concerning DECCs zealous
objections to signed/unsigned long pointers in some of the socket
calls.

But that's it ... it's _almost_ out the box and a blessed relief from
the pain of DCL.

Good luck.
 
-- 
 -----------------------------------------------------------------------
 Jonathan R Hudson                       Email: jrh@jrhudson.demon.co.uk
 WWW: http://www.jrhudson.demon.co.uk    Voice/Fax: +44 (0)1703 867843



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

Date: 3 Apr 1997 22:15:20 GMT
From: friendly@hotspur.psych.yorku.ca (Michael Friendly)
Subject: perl data structure for a data table with dictionary
Message-Id: <5i1a5o$k32@sunburst.ccs.yorku.ca>

I'm looking for an example of a perl data structure for keeping track
of a data table -- a rectangular array whose columns are variables
together with a data dictionary -- information about variable names,
type (char/numeric), length, etc.

Can someone point me in a useful direction?

--
Michael Friendly     Internet: friendly@hotspur.psych.yorku.ca (NeXTmail OK)
Psychology Dept
York University      Voice: 416 736-5118  Fax: 416 736-5814
4700 Keele Street    http://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA


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

Date: Thu, 03 Apr 1997 17:09:10 -0800
From: "Dipti V. Sonak" <dsonak@us.oracle.com>
Subject: Process Communication
Message-Id: <334454B6.78C2@us.oracle.com>

Is there a way to do this : 


system( shell_command );

	This shell_command fires of a shell of another 
	program. 

I wish to run some commands in this new shell. What is the simplest way
to do this ? 

I tried : 

system( shell_command < process_file );

	where process_file contained all the commands that I wanted to 
	run in the new shell. 

	It did not recognize the 'print' command from the process_file. 

Thanks for your help in advance.
- dipti


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

Date: Wed, 02 Apr 1997 22:09:21 -0800
From: Devin Ben-Hur <dbenhur@egames.com>
To: brian mcandrews <bmcandre@mc.net>
Subject: Re: Processing lists.
Message-Id: <33434991.7DB5@egames.com>

[mail&post]
brian mcandrews wrote:
> I have two lists of strings implemented as arrays. Can anyone help me
> with an efficient way to find which elements of list a are in list b.
> Example:
>   @a = ("Mary", "Bob", "Sammy");
>   @b = ("Mary had a little lamb", "Something Sammy", "Test");
> 
> I want the resultant list to be: ("Mary had a little lamb", "Something
> Sammy"
> Because "Mary" is pattern matched in list b and the same with "SAMMY".

So you really want elements of @b which contain any element 
in @a, yes?

This is fairly concise:
 @result = grep { my $t=$_; grep($t=~/\Q$_/,@a) } @b;

However, it's not very efficient (it doesn't exit the
search as soon as a match is found, for example).

This might be faster (builds a regex to match any
of @a, then applies it to each element of @b):
  my $pat_a = join('|', map(quotemeta $_, @a) );
  my $in_a = exec "sub { /$pat_a/o }";
  @result = grep(&$in_a, @b);

Or something like this (uses index instead of regex engine
for matching and exits inner loop as soon as hit found):
  @result = grep {
    my $found = 0;
    foreach my $a (@a) {
      if (index($_,$a) >= 0) {
        $found=1;
        last;
      }
    }
    $found;
  } @b;

Should be fine for short @a lists, but if they get big
you may want better search techniques than a linear search
(like building a DFA to match contents of @a, which some
regex engines do, but Perl's doesn't)

(none of the above code is tested, but it looks right to me)

HTH
--
Devin Ben-Hur      <dbenhur@egames.com>
eGames.com, Inc.   http://www.egames.com/
eMarketing, Inc.   http://www.emarket.com/
"It's better to be lucky than good."  -- Elizabeth Bourne




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

Date: Thu, 03 Apr 97 18:18:10 +0400
From: Konstantin Avdeev <Konstantin.Avdeev@p474.f474.n5030.z2.fidonet.org>
Subject: Re: Requesting help for idiotic (?) problem .. sigh.
Message-Id: <860095383@p474.f474.n5030.z2.ftn>

Hello Mark!

Monday March 31 1997 08:51, Mark wrote to All:

 M> $name="Answer";
 M> print("What is the answer? ");
 M> $ask=<STDIN>;
 M> chop($ask);
 M> until ($ask==$name) {

    You must use 'eq' instead of '=='.

 M>      print("\n\nNope!  Try again.\n\n");
 M>      print("What is the answer? ");
 M>      $ask=<STDIN>;
 M>      chop($ask);

    With best wishes...
Konstantin
E-Mail: akc@mdmbank.spb.ru



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

Date: Thu, 03 Apr 1997 14:34:27 -0800
From: Mike Werner <mtw@eng.sun.com>
Subject: Re: Running program on a remote machine
Message-Id: <33443073.548D@eng.sun.com>

There is a replacement for chat2.pl called comm.pl

You can find the tar archive for it on the perl web site
http://www.perl.com/perl/

Follow the links  _Software_  then  _most useful modules_

Look under _networking and i/o_ for
   Comm.pl, the new, perl4-compatible chat2 replacement 

mtw


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

Date: 03 Apr 1997 16:10:00 +0100
From: EDT Calle Dybedahl <qdtcall@k2.kiere.ericsson.se>
Subject: Re: Simple array question by newbie...
Message-Id: <is67y4w3av.fsf@k2.kiere.ericsson.se>

alweiner@clark.net (Alan Weiner) writes:

> 1) Is there a better way to do this?

Well, this is how I would've done it:

sub next_month {
    my ($now) = @_;
    my %months;

    %months = ("Jan", "Feb",
	       "Feb", "Mar",
	       "Mar", "Apr",
	       "Apr", "May",
	       "May", "Jun",
	       "Jun", "Jul",
	       "Jul", "Aug",
	       "Aug", "Sep",
	       "Sep", "Oct",
	       "Oct", "Nov",
	       "Nov", "Dec",
	       "Dec", "Jan");
    return $months{$now};
}

> 2) What am I doing wrong?
[bits snipped]
>     if($thisMonth == $_) {
>             return ($months[$#months+1]);
>             }

You've got a numeric comparison in the if(). Use eq instead.

-- 
		    Calle Dybedahl, UNIX Sysadmin
     qdtcall@kiemw.ericsson.se  http://www.lysator.liu.se/~calle/


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

Date: Wed, 02 Apr 1997 22:18:46 -0800
From: Devin Ben-Hur <dbenhur@egames.com>
To: Eryq <eryq@enteract.com>
Subject: Re: The theoretically fastest way to iterate through all bytes in a string...?
Message-Id: <33434BC6.1D08@egames.com>

[mail&post]
Eryq wrote:
> Let's say I have a long string, and I want to perform a
> mathematical operation on each byte in the string (regarded
> as a 0-255 value)... no modification involved, just an update
> of a running total (no it's not a checksum, but something like
> that.)  What, in theory, is the fastest way to do this?

I have no idea, but this is just what
use Benchmark is good for.

>         * a "for" loop with substr()? or unpack()?
>         * a while (m/./s)?
>         * others?

how about:
  foreach (split //,$str) { # calc ord($_) }
or:
  foreach (unpack('C*',$str)) { } # note no need to ord this one

HTH
--
Devin Ben-Hur      <dbenhur@egames.com>
eGames.com, Inc.   http://www.egames.com/
eMarketing, Inc.   http://www.emarket.com/
"It's better to be lucky than good."  -- Elizabeth Bourne



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

Date: 2 Apr 1997 21:05:58 GMT
From: "David Baker" <dbaker@dkburnap.com>
Subject: Re: Using Perl with MS-Access
Message-Id: <01bc3fa9$a4a79400$c7a3bece@micronclientpro.dkburnap.com>

You could have an OLE session that does the population.  That is if it is
running on a Windows OS.

Thanks,

David



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

Date: Fri, 04 Apr 1997 00:27:09 +0100
From: Demon Flash <dflash@netcomuk.co.uk>
Subject: Virtual FTP.
Message-Id: <33443CCD.9C5@netcomuk.co.uk>

Can anyone let me know where I can get a virtual FTP script from, or can
someone email me one.

I am wanting to let users create their own accounts and use a virtual
ftp account to upload into their space.  If anyone has any different
ideas to achieve this, could you please let me know.

Thanks....

-- 
Demon Flash, England.

Mailto:dflash@netcomuk.co.uk
http://www.netcomuk.co.uk/~jamesmc/dflash.htm


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

Date: 3 Apr 1997 23:40:04 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Virtual FTP.
Message-Id: <5i1f4k$hhf@fridge-nf0.shore.net>

Demon Flash (dflash@netcomuk.co.uk) wrote:
: Can anyone let me know where I can get a virtual FTP script from, or can
: someone email me one.

Try Net::FTP.

: I am wanting to let users create their own accounts and use a virtual
: ftp account to upload into their space.  If anyone has any different
: ideas to achieve this, could you please let me know.

There's a bunch of ways I'd think of doing this, but here are two (for
better or worse):

If you want this to run through a CGI script, I'd suggest the following:
(1) Use CGI.pm, available from a CPAN near you!
(2) Refer to comp.infosystems.www.authoring.cgi

OR:

Write a server that's bound to port x.  Have your server require information
from the user, and "do something with it..." to create the account.

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: Thu, 03 Apr 1997 04:32:15 -0800
From: Rich Markle <rmarkle@earthlink.net>
Subject: Re: Who makes more $$ - Windows vs. Unix programmers?
Message-Id: <3343A34F.2C7F@earthlink.net>

jason olmsted wrote:

  On Tue, 01 Apr 1997 16:43:51 -0500, "Kirk M. Sigel"
  <kmsigel@ksx.com>
  wrote:

  >Good programmers make more than bad ones. :) That's all I need to
  know.

  And I am sure there are plenty of tremendous
  programmers working for less than many mediocre ones.

  The world isn't black and white and you are not rewarded based on
  your
  merits.  Why should such an obvious condition need to be pointed
  out?

  jason olmsted
  olmstj@phat-media.com

 As anyone who has ever worked with "consultants" would whole-heartedly
agree.

--
Rich Markle >> rmarkle@earthlink.net (310)442-8086



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

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

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