[11832] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5432 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 20 16:07:26 1999

Date: Tue, 20 Apr 99 13:00:17 -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           Tue, 20 Apr 1999     Volume: 8 Number: 5432

Today's topics:
    Re: =?ISO-8859-1?B?q+e78rOjrE9FTkdMSVNIPw==?= <gellyfish@gellyfish.com>
    Re: Any source of writing chat room on homepage? (Daniel Beckham)
        Broken array pre-allocation?? (nospam)
    Re: FAQ 3.9: Is there an IDE or Windows Perl Editor? (Daniel Beckham)
    Re: for (my $i;;) doesn't work like I think it should <aqumsieh@matrox.com>
        How can I execute non cgi PERL script under NT? <alejandro.eluchans@umb.edu>
    Re: How to embed external ads <gellyfish@gellyfish.com>
    Re: Is it possible to have "..." appear while processin (Larry Rosler)
    Re: Is it possible to have "..." appear while processin <tchrist@mox.perl.com>
        Is it REALLY impossible to install Perl on Windoze??? mjw@bahnhof.se
        Make Test Problems omovision@my-dejanews.com
    Re: Making grep insensitive <aqumsieh@matrox.com>
    Re: Need example (Daniel Beckham)
    Re: Passing variables between scripts? How? (Daniel Beckham)
    Re: Perl cookbook ... <aqumsieh@matrox.com>
    Re: Perl pipe under OS/2 broken? (Ilya Zakharevich)
    Re: Perl Script to append data to text file <e.h.bogart@larc.nasa.gov>
    Re: Please Help !!!!! <jasjit@teleport.com>
    Re: Reading .ini files from Perl (Clinton Pierce)
    Re: Scripting language with LFN support? <hamilton@hamiltonlabs.com>
        to match pattern ended with 4 digits (Xiaoyan Ma)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 18 Apr 1999 11:38:41 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: =?ISO-8859-1?B?q+e78rOjrE9FTkdMSVNIPw==?=
Message-Id: <7fcg81$8bf$1@gellyfish.btinternet.com>

On Sun, 18 Apr 1999 17:15:45 +0800 perl wrote:
> &3(S&3$$$e0Q=W*:&a$h'r?
> 

I think you want comp.lang.apl 

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Tue, 20 Apr 1999 14:48:19 -0500
From: danbeck@scott.net (Daniel Beckham)
Subject: Re: Any source of writing chat room on homepage?
Message-Id: <MPG.118695fc4f08d9fb9896ae@news.idt.net>

HA!! funny...  I'd give it a 17.3% probability with a .10302% margin of 
error.

In article <7fgunv$hvg$4@client2.news.psi.net>, abigail@fnx.com says...
> Carfield Yim (carfield@polyu.hknet.com) wrote on MMLVI September MCMXCIII
> in <URL:news:3719EB68.B1965A8C@polyu.hknet.com>:
> -- As title, Can I write the ICQ chat room like thing and play it at
> -- browser?
> 
> 
> Perhaps. Since you have to ask, I estimate the probability that
> you can is less than 25%.
> 
> 
> Abigail
> 


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

Date: Tue, 20 Apr 1999 14:21:45 -0400
From: "Henry Cox" <henry_cox@Si(nospam)FR.com>
Subject: Broken array pre-allocation??
Message-Id: <7figlb$77r@dfw-ixnews10.ix.netcom.com>
Keywords: array, pre-allocation, fragmentation



Greetings.  And apologies in advance, if this turns out to be
an off-topic, frequently asked, or just plain dumb question.
Sadly, I couldn't find an answer in the FAQs, the online docs,
etc.

I have an application which builds a (potentially) very large
array of objects.  In testing my application, I discovered some
very unpleasant memory utilization effects.  After some digging,
I began to suspect a classic "realloc-and-leave-large-but-unusable-
memory-behind" problem.  I then discovered the "assign to $#arrayName"
trick (camel book, p.49 and p.541) - which I thought was intended
to solve exactly this problem.  But it didn't.

I then wrote this tiny program, to illustrate the issue:

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

use strict;

my @myArray;
my $count = 10000000;
$#myArray = $count;
my $i;
for ( $i=0 ; $i<$count; $i++ ) {
    $myArray[$i] = undef;
    print "...$i\n" if ( 0 == ($i % 100000));
}
print "...done...";
------------ snip snip -------

When I run the program (Perl 5.004_02 on both Solaris 2.5.1 and winNT
4.0sp3,), I see the following:
   - my process grows a lot, when $#myArray is assigned (...as expected).
   - the process continues to grow (slowly, but continuously), as each
     entry in @myArray is progressively assigned to "undef".
     This is _not_ what I expected.  (same thing happens if I assign
     each entry to, say, an constant integer - or anything else.)
Memory _appears_ to start to grow the instant I assign to $myArray[0] -
but this is hard to judge.  It has _definitely_ grown by the time the
first "print" is executed.

What I expected:
   - perl would suck up lots of memory (10M words, give or take) when I
     preallocate the array.
   - perl would (automagically) assign each entry in the array to 'undef'
   - my loop would be a giant no-op, simply re-assigning each entry to
'undef'.

So my question:  what the heck is going on here?  Is this a bug, a feature,
or am I missing something?
  Or, more generally, how can I convince Perl to pre-allocate a large
space, then use it?  (If it helps, I know, or can come to know, exactly
how large I need the array to be, before I allocate it.)

Thanks

                    Henry

--
Henry Cox              100 Treble Cove Rd., Suite 6  Billerica MA 01862
henry_cox@SiFR.com     ph: (978) 439 9605
                     fax: (978) 439 9606








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

Date: Tue, 20 Apr 1999 14:46:47 -0500
From: danbeck@scott.net (Daniel Beckham)
Subject: Re: FAQ 3.9: Is there an IDE or Windows Perl Editor?
Message-Id: <MPG.118695a5b8204e739896ad@news.idt.net>

Sorry, TextPad32 beats them all (maybe not the unix ports..).  I'm beta 
testing 4.0 which includes nice syntax highlighting...  It supports 
regex, macros and several other really nice options...  

www.textpad.com

Daniel

In article <7fdafg$2qf$1@starburst.uk.insnet.net>, gs_london@yahoo.com 
says...
> and another good win32 editor is {
> 
> Programmer's File Editor is available from a wide range of archive sites
> throughout the world.
> The definitive source of releases and up-to-date information about PFE is
> the PFE Home Page on the World Wide Web, which you can find at
> http://www.lancs.ac.uk/people/cpaap/pfe/
> }
> 
> 
> Andrew Perrin wrote in message
> <371A0A72.2816420C@mcmahon.qal.berkeley.edu>...
> >Just FYI, emacs for Windows can be found at
> >http://www.cs.washington.edu/homes/voelker/ntemacs.html
> >
> >Cheers,
> >Andy Perrin
> >
> >
> 
> 
> 


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

Date: Tue, 20 Apr 1999 13:08:47 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: for (my $i;;) doesn't work like I think it should
Message-Id: <x3yd80zw76o.fsf@tigre.matrox.com>


raylutz@adaptra.com writes:

> Consider the following code segment:
> {
>     # pass one
>     my $i; my $j = 0;
>     for ($i = 0; $i < 8; $i++) {
>         print "pass 1: \$i=$i\n";
>         $j++;
>         }
> 
>     print "Pass 1 End: \$j = $j;\n\n";
> 
>     # pass two
>     my $j = 0;
>     for (my $i = 0; $i < 8; $i++) {
>         print "pass 2: \$i=$i\n";
>         $j++;
>         }
> 
>     print "Pass 2 End: \$j = $j;\n\n";
> }
> The only difference between pass one and two is the 'my' in the for().
> According to the perl docs I've read, these SHOULD do the same thing.
> But they don't. Here is the result:
> 
> ---------------------
> pass 1: $i=0
> pass 1: $i=1
> pass 1: $i=2
> pass 1: $i=3
> pass 1: $i=4
> pass 1: $i=5
> pass 1: $i=6
> pass 1: $i=7
> Pass 1 End: $j = 8;
> 
> Pass 2 End: $j = 0;
> ---------------------
> Note that pass 2 is skipped completely. Why?

Well, for me it doesn't:

pass 1: $i=0
pass 1: $i=1
pass 1: $i=2
pass 1: $i=3
pass 1: $i=4
pass 1: $i=5
pass 1: $i=6
pass 1: $i=7
Pass 1 End: $j = 8;
 
pass 2: $i=0
pass 2: $i=1
pass 2: $i=2
pass 2: $i=3
pass 2: $i=4
pass 2: $i=5
pass 2: $i=6
pass 2: $i=7
Pass 2 End: $j = 8;

Methinks you are using an old version of Perl that might not be
supporting the my() keyword. Do a perl -v and check if you have
version 5 or higher. If not, upgrade.

HTH,
Ala



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

Date: Tue, 20 Apr 1999 15:12:40 -0500
From: Alejandro Eluchans <alejandro.eluchans@umb.edu>
Subject: How can I execute non cgi PERL script under NT?
Message-Id: <371CDFB8.7503D706@umb.edu>

I got Perl Builder for NT and it works great.

Now, I need to run my PERL scripts (under Win NT) independently of any
web server or PERL utility.
Maybe using DOS line command (like UNIX) or maybe double clicking on a
(.exe) icon?
How do I get the PERL interpreter to "compile" my script?

Thanks,

Alejandro







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

Date: 18 Apr 1999 11:44:41 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How to embed external ads
Message-Id: <7fcgj9$8bi$1@gellyfish.btinternet.com>

On Sat, 17 Apr 1999 22:12:57 -0400 webman wrote:
> I want to embed banner ads in the header output of a working cgi script.
> My ads are served up by this code:
> 
print <<EIEIO;
> <A HREF="http://www.sample.com/ads/ad9999-map.cgi">
>      <IMG SRC="http://www.sample.com/cgi-bin/ads/ad9999.cgi"
>                BORDER=0 WIDTH=468
>      HEIGHT=60></A>
> 
EIEIO
> How can I call this code from  within the first script ? Thanks from a
> cgi neophyte.
> 

You cant 'call' that from a Perl program because it is HTML and Perl
doesnt know anything about HTML - you can print it as I have indicated
above however.

Bear in mind that programs that use the CGI are only a small part of the
use that Perl is put to you will probably find more like minded souls at:

comp.infosystems.www.authoring.cgi

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Tue, 20 Apr 1999 11:41:57 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Is it possible to have "..." appear while processing?
Message-Id: <MPG.11866a4df1cf0fbd9898f1@nntp.hpl.hp.com>

In article <371ebc22.562267@news.skynet.be> on Tue, 20 Apr 1999 17:44:41 
GMT, Bart Lateur <bart.lateur@skynet.be> says...
> Steve Wells wrote:
> >      unless ($answer =~ # this works case insensitvely for 
> >                         # y, yes, yup, yeah, yep and (ye, yu, yus and yuah too)
> >                   /^[Yy](?:[Ee]|[Uu])?(?:[Ss])?(?:[Aa][Hh])?(?:[Pp])?$/);
> 
> You really dispise this?
> 
> 	/^y[eu]?s(?:ah)?p?$/i
> or
> 	/^(?:y|yes|yup|yeah|yep)$/i
> 
> or even
> 
> 	(lc $answer) =~ /^y[eu]?s(?:ah)?p?$/
> 
> 
> Which ALL are more easy to grasp?

I recall a post (perhaps in c.l.p.modules) proposing making this 
response mechanism locale-dependent.  In the meantime:

English      yes   no
French       oui   non
German       ja    nein
Italian      sl    non
Portuguese   sim   nco
Slavic       da    nyet
Spanish      sm    no
 ...

Perhaps the easiest way to cover the most bases now is this:

    $answer =~ /^[^\WNn\d_]/;  # Any letter except N or n.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 20 Apr 1999 12:55:52 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Is it possible to have "..." appear while processing?
Message-Id: <371ccdb8@cs.colorado.edu>

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

In comp.lang.perl.misc, 
    lr@hpl.hp.com (Larry Rosler) writes:
:I recall a post (perhaps in c.l.p.modules) proposing making this 
:response mechanism locale-dependent.  In the meantime:
:
:English      yes   no
:French       oui   non
:Spanish      sm    no

Actually, the French answer to positive questions in "oui", but to
negatives is "si".  So, "Shall I delete your file?" (rendered into French,
of course) gets "oui" or "non", but "Shall I not delete your file?"
gets "si" or "non".

So much for binary answers. :-)

--tom
-- 
Welcome to Microsoft!
Plase set your watch back 20 years.


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

Date: Tue, 20 Apr 1999 21:01:36 +0200
From: mjw@bahnhof.se
Subject: Is it REALLY impossible to install Perl on Windoze???
Message-Id: <MPG.1186ed807b2b64c2989691@news.supernews.com>

I am getting really mad. 

More times than I want to remember I tried to install Perl
under Win95, on three different machines:
1. My humble, hopelessly obsolete Pentium 133 MHz
2. Compaq Armada 233 MHz notebook in my office
3. A Dell desktop PC in my office.

I used various builds of Perl. I tried many times to
carry out every installation. I tried every conceivable
measures, deactivated antivirus programs (WHY, ON EARTH,
IS IT NECESSARY???), switched off the lights in my room,
prayed to God and so on.

NOTHING. NULL. ZERO SUCCESS.

The ActiveState installation program freezes always
when "preparing HTML documentation", at 95%, leaving
the installation unfinished (I believe that 60 min
waiting for the program to continue - was enough...).

Ok. I bought a book "Perl 5 Complete" from Mc Graw-Hill,
a respectable publishing house. I inserted the attached
CD-ROM into my computer and started installation -
perhaps not the latest build, but presumably "stable".

The installation program showed to be a worthless piece 
of crap, completely broken, unusable. Probably nobody
ever tested it.

Is there anything I can do  before I start hating Perl
and send millions of anti-Perl spam messages on the whole 
net?

What the hell can go wrong in an installation program
that does little more than copying files and writing
some info in the registry? 

Is it really impossible for the Perl community to prepare
a package for MANUAL installation, with all files neatly
packed, together with the directory tree, in a ZIP archive 
or similar, ready to copy "as is"?

Regards
MJ Wiechowski


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

Date: Tue, 20 Apr 1999 18:36:46 GMT
From: omovision@my-dejanews.com
Subject: Make Test Problems
Message-Id: <7fihfu$6ts$1@nnrp1.dejanews.com>

I'm trying to install Perl on UnixWare 2.1,  I've tried version 5.004_04
during the make test it fails on the lib/IO_sel test.  I have also tried
version 5.005.02 and it failed on the die_EXIT test during the make test.
Any ideas on how to fix these problems?

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 20 Apr 1999 13:22:58 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Making grep insensitive
Message-Id: <x3y90bnw6j1.fsf@tigre.matrox.com>


Kevin Slanicky <slanicky@students.uiuc.edu> writes:

> Sure did, but didn't come up with anything.  Did I miss something?
> 
> On 20 Apr 1999, Greg Bacon wrote:
> 
> > : @results = grep (/$multiple/, @results);
> > 
> > Did you bother searching the fine perlre manpage for insensitive?

I don't believe you.

	% grep insensitive perlre.pod
	Do case-insensitive pattern matching.
	insensitive ones need to include merely C<(?i)> at the front of the



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

Date: Tue, 20 Apr 1999 14:54:09 -0500
From: danbeck@scott.net (Daniel Beckham)
Subject: Re: Need example
Message-Id: <MPG.11869760e206bc959896af@news.idt.net>

[This followup was posted to comp.lang.perl.misc and a copy was sent to 
the cited author.]

Sorry man... cgi is a spec, not a language.  Perl is to powerful to be 
only relegated to it's simple use as a cgi scripting language.  Your 
question had nothing to do with perl and everything to do with a cgi 
newsgroup...  You can write cgi in, python, tcl/tk, vb, vc, c, c++, 
basic, pascal, java and pretty much any other language in existence.

Daniel

In article <371A4776.9D294505@newglobal.net>, jim@newglobal.net says...
> Well, let's see...Forms > cgi > perl.
> 
> Interesting how that works!
> 
> Do you need any more help understanding my question, Mr. Perl Programming man?
> 
> Or do you have nothing else better to do than start some stupid flame war on
> what I thought would be a helpful newgroup?
> 
> In the mean time, KMA!


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

Date: Tue, 20 Apr 1999 15:06:42 -0500
From: danbeck@scott.net (Daniel Beckham)
Subject: Re: Passing variables between scripts? How?
Message-Id: <MPG.11869a48ab1f79a99896b0@news.idt.net>

Heh, for once, it's not quite clear that he's not talking about a real 
perl script or CGI... Although, his e-mail address sort of clues you 
in...  It would be two totally different solutions depending on what you 
were doing.  If this is for the web browser, see the cgi newsgroups, if 
this is just for a set of regular old perl scripts, see the other post 
about environment variables.

Daniel

In article <371B6DEC.A947D40B@mail.cor.epa.gov>, cassell@mail.cor.epa.gov 
says...
> cgi@higherlove.com wrote:
> > 
> > I have some scripts set-up allowing people to search a database and
> > then contact others if they need to whom they find through the
> > database. What I was wondering...is there anyway that I can keep a
> > user's login name variable constant with them in the system, so they
> > don't have to keep entering their basic "name, email, etc."
> > information everytime they contact another database user? How can I
> > send a session/user idenitifier with them through all their system
> > usage?
> 
> Lisa, this is really a CGI problem not a Perl problem.  You would have
> better luck asking this in a newsgroup such as 
> comp.infosystems.www.authoring.cgi .
> 
> That said, look into the CGI.pm module, which can help you with this.
> 
> HTH,
> David
> 


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

Date: Tue, 20 Apr 1999 13:18:54 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
To: Ron Reidy <rereidy@uswest.net>
Subject: Re: Perl cookbook ...
Message-Id: <x3ybtgjw6pt.fsf@tigre.matrox.com>


[posted and CCed]

Ron Reidy <rereidy@uswest.net> writes:

> A co-worker of mine was writing a SIMPLE perl program to send e-mail to
> a group of users when a certain event has cmpleted processing on our
> server.  He used an example right from the cookbook, but it didn't work.
> 
> The cookbook example is locate on page 651:
> 
> open(SENDMAIL, "|/usr/lib/sendmail -oi -t -odq")
>     or die "Can't fork for sendmaile: $!\n";
> ...
> ...
> ...
> 
> 
> We could not force the die statement to fail.  Is it me/him, or is there
> something missing here.

The Cookbook is a great book. But it doesn't substitute the docs and
FAQs, since it wasn't intended to do so in the first place. I suggest
you always refer to the perldocs and perlfaqs whenever you encounter a
bizarre behaviour since they might contain hints as to what the
problem really is. In your case, the answer to your dilemma is
embedded in the 'perlipc' doc. Read the section on 'Using open() for
IPC'. At the end of that section, you'll find your answer:

     Be careful to check both the open() and the close() return
     values.  If you're writing to a pipe, you should also trap
     SIGPIPE.  Otherwise, think of what happens when you start up
     a pipe to a command that doesn't exist: the open() will in
     all likelihood succeed (it only reflects the fork()'s
     success), but then your output will fail--spectacularly.
     Perl can't know whether the command worked because your
     command is actually running in a separate process whose
     exec() might have failed.  Therefore, while readers of bogus
     commands return just a quick end of file, writers to bogus
     command will trigger a signal they'd better be prepared to
     handle.  Consider:
 
         open(FH, "|bogus");
         print FH "bang\n";
         close FH;
 

Does that help?

Ala



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

Date: 20 Apr 1999 18:04:17 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl pipe under OS/2 broken?
Message-Id: <7fifj1$7g5$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to J|rgen Ibelgaufts 
<ibelgaufts@gfc-net.de>],
who wrote in article <371C4F65.22A30BD0@gfc-net.de>:
> Is there some kind of magic globbing under OS/2 before Perl or
> EMX hands the command over to cmd.exe? Is it possible to turn it
> off?

There is no magic globbing.  However, as documentation for
system()/open() says, if the command contains shell metachars, it is
handled via the shell.  The shell in question under OS/2 is pdksh.

To avoid passing the command to the shell, you may use multi-arg
syntax like this (stolen from t/lib/io_pipe.t):

  $pipe = new IO::Pipe->reader($perl, '-e', 'print "not ok 1\n"');
  while (<$pipe>) {
    s/^not //;
    print;
  }

Ilya


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

Date: Tue, 20 Apr 1999 15:10:21 -0400
From: Ed Bogart <e.h.bogart@larc.nasa.gov>
Subject: Re: Perl Script to append data to text file
Message-Id: <371CD11D.6D127819@larc.nasa.gov>

Uri Guttman wrote:
> 
> >>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
> 
>   >> I think what you need is a good book, I'm a beginner as well and
>   >> found a really easy book about perl. I would consider it the
>   >> "coloring book" of perl, but it covers all fundementals.
>   >>
>   >> PERL & CGI by Elisabeth Castro almost right out of the book page
>   >> 193
> 
>   LR> Well, for sure it is sick-sick-sick.
> 
> i am of the conclusion that if newbies find a perl book easy, it must be
> a bad book. not that perl is hard, but writing about it in a so-called
> easy style always seems to be frought with bugs. if you can't grok the
> llama or camel, you might not be in the right profession of vocation.
> 
> oh, why is our field so easy to enter? how many newbies are there in
> medicine or accounting?
> 
> hey, that disease was covered in "liver infections for dummies". just pump
> him full of amoxycillin. it seems to work on my dog.
> 
> stand aside from that collapsed man, i can do a triple bypass on him
> with my swiss army knife and my fountain pen (shades of danny kaye's
> walter mitty!). i read about it in "learn cardiac surgery and
> needlepoint in 21 days".
> 
> :-)
> 
> uri
>
Or they may be experienced programmers who are new to Perl. Kinda like a
proctologist delivering a baby. It's in their area of specialization
but....

Ed


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

Date: Tue, 20 Apr 1999 12:47:24 -0700
From: Jasjit Singh <jasjit@teleport.com>
Subject: Re: Please Help !!!!!
Message-Id: <371CD9CC.838D77EC@teleport.com>


$email = "someone@somewhere.someplace";
$message = "This is the body of the mail message.\n";
system("mailx -s \"This is the subject line\" $email < $message");

ranjeev_s._pamnani@hud.gov wrote:
> 
> Hi,
> 
> I am new to perl and want to execute a unix command (mailx) from within perl.
> Can anyone let me know how to invoke a unix command from within a perl script?
> 
> Thanks in advance,
> Ranjeev
> 
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own


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

Date: Tue, 20 Apr 1999 17:53:14 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: Reading .ini files from Perl
Message-Id: <371fbd0e.1740755494@news.ford.com>

[poster cc'd in e-mail]

On Tue, 20 Apr 1999 17:10:25 GMT, "Scott W" <swolfington@home.com> wrote:
>Hi!
>
>Is it possible to read and search .ini files in Perl For Win32?  I know
>I could just read in the file line by line, but was wondering if there is a
>Perl module that makes it a little easier.  Thanks in advance!

In DCI's "Crash Course In Perl" one of the labs does almost exactly this.
(Since we teach on Win32 systems "win.ini" is something everyone has and
is familiar with.)  We create DBM files using the win.ini file as a source
for data.  The lab is at:

     http://www.geeksalad.org/business/training/perl/Lab5.html

And one solution is:


http://www.geeksalad.org/business/training/perl/solutions/Sol-Lab5.html

 .ini is actually a really easy format to parse in Perl...

-- 
Clinton A. Pierce       "If you rush a Miracle Man, you get rotten
clintp@geeksalad.org        Miracles."  -- Miracle Max, The Princess Bride
http://www.geeksalad.org


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

Date: 20 Apr 1999 16:47:19 GMT
From: "Nicole Hamilton" <hamilton@hamiltonlabs.com>
Subject: Re: Scripting language with LFN support?
Message-Id: <01be8b4d$745b5d80$0732180c@hamiltonlabs>

amacleod@altavista.net wrote
> Is there a scripting language in NT (akin to shell, batch,
> perl etc.) that supports long file names?
> 
> NT's DOS CLI only supports long file names for built in
> commands (cd, md, rd, copy, ren, dir, type...) which
> makes it worthless.
> 
> I'm hoping to write platform independent install scripts
> that can manage files on both NT and UNIXwith minimal
> change.

The suggestions you've already gotten to consider perl (available free on
the net) are certainly good ones, not knowing too much about what you
intend in your scripts.  But if the nature of your scripts is that you
expect to have to do more general munging around through the filesystem or
starting up and managing other processes, you may find that a genuine
UNIX-style shell and utilities would be better suited to the task.

Again, you know your requirements better than I, but if a shell and
utilities does sound intriguing, may I suggest you take a look at Hamilton
C shell.  This product is a complete recreation from scratch of the UNIX C
shell and all the usual suspects like grep, fgrep, head, tail, sort, diff,
cmp, mv, cp, rm, sed, tar, cron, strings, more, ls, chmod, chown, cut,
paste, touch, tee, su, xargs and many others.  The C shell itself supports
everything in the original but adds things like block-structured local
variables, procedure, built-in functions like printf, floating point,
command and filename completion, improved wildcarding and lots more. 
Naturally, everything in the entire product does support long and
mixed-case filenames as well as UNC (network) names.

You can browse the on-line user guide and other docs and download a free
demo version from my website at http://www.hamiltonlabs.com.  If you have
any questions you don't find answered there, send me mail.  I am the author
and I promise a prompt response.

Regards,
Nicki Hamilton

Nicole Ashley Hamilton    KD1UJ    hamilton@hamiltonlabs.com
http://www.hamiltonlabs.com   Phone 781-487-0008   FAX 781-487-0009
Hamilton Laboratories, 45 Kings Way, Unit 14, Waltham, MA  02451-9039, USA



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

Date: Tue, 20 Apr 1999 12:17:39 -0700
From: xma@Haas.Berkeley.EDU (Xiaoyan Ma)
Subject: to match pattern ended with 4 digits
Message-Id: <371CD2D3.3A034E0D@haas.berkeley.edu>

I have a Perl subsidiary file which looks like this:

02AAAB        1
01                      2
02DDDE        25
04                    26
03BBBC        27
02RREE        30
 ....

and when the main program calls this file it converts the left colum
into the right colum:

sub init_type {
              open (RECORDTYPES, "rtypes");
              while ($name = <RECORDTYPES>) {
               $rtypes(substr($name,0,6)} = substr($name,7,2);
       }
close (RECORDTYPES);


I have been trying to add one new type of record that is "02" followed
by any combination of 4 digits and convert it into say "33". I have
tried "02\d\d\d\d", "02\d{4}" and "02[0-9]{4}", neither one worked.
Then I retyped the subsidiary file, setting tabstop to 12, and changed
the last line into:
          $rtypes(substr($name,0,10)}=substr($name,11,2);
                          or      ($name,0,6)
($name,7,2)


But it still did not work. Should "02\d\d\d\d" be counted as 6 or 10.
What is wrong?  I would really appreciated if anyone can give me some
tips.

Thanks.

Xiaoyan





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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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