[11181] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4781 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 29 19:07:11 1999

Date: Fri, 29 Jan 99 16:00:22 -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           Fri, 29 Jan 1999     Volume: 8 Number: 4781

Today's topics:
    Re: A question about filehandle <aqumsieh@matrox.com>
    Re: Can you launch a background process from web page? (Greg Ward)
        Can't assign an array to a hash key in a dbm file? (Brian Kendig)
    Re: Can't assign an array to a hash key in a dbm file? <cdkaiser@delete.these.four.words.concentric.net>
        comparison not working($1 vs $array[$i]) perlstudent@my-dejanews.com
    Re: Finding/Printing system uptime in perl (Abigail)
    Re: Finding/Printing system uptime in perl <tchrist@mox.perl.com>
    Re: Help with simple Perl problem. (Tad McClellan)
    Re: Newbie Shopping Cart Question <chester@ma.ultranet.com>
        NEWBIE: ok, I suck (John P. Abe (Rhialto))
    Re: NEWBIE: ok, I suck <ludlow@us.ibm.com>
    Re: NEWBIE: ok, I suck <ludlow@us.ibm.com>
    Re: NEWBIE: ok, I suck <cdkaiser@delete.these.four.words.concentric.net>
    Re: NEWBIE: ok, I suck <allan@due.net>
    Re: NEWBIE: ok, I suck <ebohlman@netcom.com>
    Re: Perl 5.002 on AIX ---> Perl 5.0x on MkLinux (Proble (I R A Aggie)
    Re: Perl Criticism (Bart Lateur)
    Re: Perl Criticism topmind@technologist.com
    Re: Perl Criticism (K. Krueger)
    Re: Perl Criticism (Alan Barclay)
    Re: Perl Criticism (Scott Stursa)
        Perl Tk lacpt97@my-dejanews.com
    Re: Problem printing nested string variables? (Greg Ward)
    Re: Problem: IIS 4 doesn't pass URL path suffix to scri <emschwar@mail.uccs.edu>
    Re: regex lib or Perl linked in? <jimmy@globalSpam.org>
    Re: SED command in PERL through HTML <halxd2@my-dejanews.com>
    Re: strange behaviour with tr/// tommy927@my-dejanews.com
    Re: string to integer conversion <aqumsieh@matrox.com>
        URGENT: Find and Replace in Registry using Perl satkinson@freemarkets.com
    Re: Using Perl to interrogate Hotmail <cdkaiser@delete.these.four.words.concentric.net>
    Re: Using Perl to interrogate Hotmail (I R A Aggie)
    Re: Visitor email! How? <allan@due.net>
    Re: Win32: passing values into functions <paullyb8@fnol.net>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Fri, 29 Jan 1999 15:07:16 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: A question about filehandle
Message-Id: <x3y4sp9x2q4.fsf@tigre.matrox.com>


"Stephen Correia" <tumtum73@yahoo.com> writes:

> 
> Zhengdong Zhang wrote in message <36A8C722.32D7@bayou.uh.edu>...
> >
> >But if I use the following code and input the name(including the path)
> >of a file in a directory other than the current working directory, I
> >will get an error message.
> >         print "Enter the filename: ";
> >         $in = <STDIN>;
> >         chomp $in;
> >         open(IN, "$in") || die "$!";
> >My current working directory is /zzhang. When I run the program I enter
> >/zzhang/data/a at the prompt. I get an error message like "No such
> >file." Is it possible to specify the directory of a file at run time
> >when open a filehandle?

That should work fine. I just tried it to make sure, and it does. Are
you sure you enter the correct file name? what version of Perl are you
using?

> >Thanks,
> >Z.Zhang
> 
> Use variables!  Don't specify a file and path at runtime.   Load that file
> into a variable once in the beginning of the program and make your life much
> easier.

That is what he's trying to do .. isn't it? Did you read the question
carefully? 

Also, loading "that file into a variable once in the beginning of the
program" might not be very useful depending on what he intends to
do. That's not good advice IMO.

Ala



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

Date: 29 Jan 1999 22:13:16 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: Can you launch a background process from web page?
Message-Id: <78tbps$6nl$1@news0-alterdial.uu.net>

Robbin <Robbin.Brahms@trw.com> wrote:
> This is a multi-part message in MIME format.
> --------------C5C6748D6F4EBA5719DB3FED

Please don't do this.  USENET is a plain ASCII text medium; let's keep
it that way.

Also, posting the same message three times is not very nice.  Careful!

> I'm somewhat new to Perl and was wonder if someone has a sample script and
> willing to share that will start a client application from a web page, so
> that the client
> app will run in the background and bring up it's own gui.
> 
> like if wanted to start emacs off a web page, or  the clock or calendar on
> Solaris desktop.

I don't, no, but it should be pretty easy to do with fork and exec.  Try
reading the fine documentation: 'perldoc -f fork', 'perldoc -f exec',
'perldoc perlipc'.  Of course, you need to be running on a REAL
operating system to use fork.  ;-)

        Greg

-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


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

Date: 29 Jan 1999 14:59:39 -0800
From: fox-at-enchanter-net@SPAM.BLOCK (Brian Kendig)
Subject: Can't assign an array to a hash key in a dbm file?
Message-Id: <78tegr$nbu$1@shell11.ba.best.com>

Neither I nor any other pairs of eyes who have looked at this here have
been able to figure it out.

(1) I want to take a multi-line field from a web form submission, turn
it into an array, and store that in a hash in a DBM file.  Here's my
code to do that:

  dbmopen(%DB, $db, undef);
  $listname = $input{'listname'};  $listcontents = $input{'listcontents'};
  $DB{$listname} = [ split($listcontents) ];
  dbmclose(%DB);

Page 267 of the blue camel book leads me to believe that this should
work.  However, the actual value which gets assigned to the hash key is
the string "ARRAY(0x1005fae4)".  Why is this?

The only explanation I can think of is that it's trying to store the
array by reference instead of by value, and it's useless to store a
reference in a data file -- the referenced array will be long gone the
next time the program runs.

(2) Just for kicks I tried storing the value as a string instead of an
array, but that didn't work either:

  dbmopen(%DB, $db, undef);
  $listname = $input{'listname'};  $listcontents = $input{'listcontents'};
  $DB{$listname} = join(' ', split($listcontents));
  dbmclose(%DB);

I do a 'split' in a 'join' to change $listcontents from
newline-delimited to space-delimited; it's not the most efficient way,
but it should work, shouldn't it?  It doesn't -- the 'join' function
isn't returning anything.  What am I doing wrong here?

(3) For future reference, how do I translate 'dbmopen'/'dbmclose' calls
into 'tie'/'untie' calls?  I see that 'dbmopen' is deprecated in Perl 5,
but there are so many options to 'tie' that I don't know what to use to
achieve the same exact functionality of 'dbmopen'.

Replies on the newsgroup are preferred, but if you reply by email, note
my spamblocked address.  Thank you very much!

-- 
 ____    |\/|                  Brian Kendig   
 \  /\   / ..__.       fox at enchanter net     You are in a maze of twisty
  \/  \__\   _/    http://www.enchanter.net/    little passages, all alike.
   \__   __  \_       Be insatiably curious.  
      \____\___\            Ask "why" a lot.  


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

Date: 29 Jan 1999 15:27:01 PST
From: Cameron Kaiser <cdkaiser@delete.these.four.words.concentric.net>
Subject: Re: Can't assign an array to a hash key in a dbm file?
Message-Id: <78tg45$hr1@chronicle.concentric.net>

fox-at-enchanter-net@SPAM.BLOCK (Brian Kendig) writes:

>(1) I want to take a multi-line field from a web form submission, turn
>it into an array, and store that in a hash in a DBM file.  Here's my
>code to do that:

>  dbmopen(%DB, $db, undef);
>  $listname = $input{'listname'};  $listcontents = $input{'listcontents'};
>  $DB{$listname} = [ split($listcontents) ];
>  dbmclose(%DB);

>Page 267 of the blue camel book leads me to believe that this should
>work.  However, the actual value which gets assigned to the hash key is
>the string "ARRAY(0x1005fae4)".  Why is this?

Because you are not dereferencing the array reference returned by [ ]. Have
you considered

	foreach (@{ $DB{$listname} }) { print; }

Most importantly, have you considered that you are not providing a pattern to
split()?

>The only explanation I can think of is that it's trying to store the
>array by reference instead of by value, and it's useless to store a
>reference in a data file -- the referenced array will be long gone the
>next time the program runs.

You can make sure you get a new array, if you really want to force the issue.

	my @fart = split($listcontents);
	$DB{$listname} = \@fart;

Every time the my is run, a new instance of @fart within the block is
created anew. Note "within the block".

>(2) Just for kicks I tried storing the value as a string instead of an
>array, but that didn't work either:

>  dbmopen(%DB, $db, undef);
>  $listname = $input{'listname'};  $listcontents = $input{'listcontents'};
>  $DB{$listname} = join(' ', split($listcontents));
>  dbmclose(%DB);

>I do a 'split' in a 'join' to change $listcontents from
>newline-delimited to space-delimited; it's not the most efficient way,
>but it should work, shouldn't it?  It doesn't -- the 'join' function
>isn't returning anything.  What am I doing wrong here?

If you want that, again, you should be providing a pattern to split().

	split(/\n/, $listcontents)

should work delightfully.

--
Cameron Kaiser * cdkaiser.cris@com * powered by eight bits * operating on faith
  -- supporting the Commodore 64/128:  http://www.armory.com/~spectre/cwi/ --
   head moderator comp.binaries.cbm * cbm special forces unit $ea31 (tincsf)
personal page http://calvin.ptloma.edu/~spectre/ * "when in doubt, take a pawn"


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

Date: Fri, 29 Jan 1999 23:30:42 GMT
From: perlstudent@my-dejanews.com
Subject: comparison not working($1 vs $array[$i])
Message-Id: <78tgb3$fbq$1@nnrp1.dejanews.com>

hi
can  someone help here?

I read in onefile into array, and try to match with another file(reading line
by line)..the code works as expected if i set the first array manually like
@array = ("abcd" ,"efgh")

It compares first element of array correctly. When i print out the values of
comparison statement just before the if statement it gives me same output but
does not match for some reason!!!

I know i could use grep .???
Please help....

thanks
perlstudent



Data
File1
abcd
efgh

File2
abcd:$bjklp/blah/blah/blahabcd
gfh:$zzzzzz/blah/blahgfh
efgh:$kkkkk/blah/blahefgh

Required o/p
@array =(/blah/.../blahabcd /blah/blahefgh);

<<2 elements  but i get only 1 elements

code

#!/usr/local/perl5 -w

<snipping of use strict use vars.etc>
$debug = 1;

open (INPFILE ,"<file1") || die "Cannot open file1 $!\n";
chomp (my @array = <INPFILE>);
close INPFILE;

open (INPFILE1 ,"<file2") || die "Cannot open file2 $!\n";
    while (<INPFILE1>)
        {
         chomp;
         if ($_ =~ /(.*):(\$\w+)\/(.*)/ )
         {
	  for ($i = 0; $i <@array; $i++)
           {
                print "$array[$i] $1\n" if $debug; #exatly equal but no match
                sleep 1;
                if ($array[$i] eq "$1")
                {
                push (@required, "$3/anything/$array[$i].junk");
                print "@required..adding...???\n" if $debug;
                }
           }
         }
        }
   close INPFILE1;
   print "@required" if $debug;

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


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

Date: 29 Jan 1999 20:47:56 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Finding/Printing system uptime in perl
Message-Id: <78t6ps$mn7$1@client2.news.psi.net>

Daniel (daniel.mendyke@digital.com) wrote on MCMLXXVI September MCMXCIII
in <URL:news:78qic2$o6d$1@nntpd.lkg.dec.com>:
~~ 
~~ What is a quick and dirty way to print system uptime
~~ from a perl script?

print `uptime`;


Abigail
-- 
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))


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

Date: 29 Jan 1999 16:27:43 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Finding/Printing system uptime in perl
Message-Id: <36b243ef@csnews>

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

In comp.lang.perl.misc, abigail@fnx.com writes:
:: (request for load average on redhat system)
:print `uptime`;

Abigail, Abigail, Abigail!  

Why didn't you put a full path?  Shouldn't that be /usr/bin in case
there's something else in the path.  Wait, I mean /usr/ucb for SunOs.
Stupid non-portable venders.  Try both.  Or more.

    $load = `/usr/bin/uptime || /usr/ucb/uptime || /bin/uptime`;

And hey, is that not an external hsell command such as you were just so
recently complaining about?  Don't you mean instead something like:

    open(LA, "< /proc/loadavg") or die $!;
    ($one, $five, $fifteen) = split ' ', <LA>;

No, that's linux only.  I bet you prefer the tried-and-true method of
lseeking around kmem and read out the avenrun array.  

    lseek(kmem, (off_t) Nl[X_AVENRUN].n_value, SEEK_SET);
    read(kmem, (char *) avenrun, sizeof(avenrun));

Gosh, maybe you did the right thing after all. :-)

--tom
-- 
    "You can't have filenames longer than 14 chars.  
     You can't even think about them!"
        --Larry Wall in Configure from the perl distribution


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

Date: Fri, 29 Jan 1999 14:39:44 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Help with simple Perl problem.
Message-Id: <ga6t87.me1.ln@magna.metronet.com>

mike@mjm.co.uk wrote:
: >
: >open (INFILE, $thefile) or die "Sorry that file seems not to exist.\n";
: Try replacing the above line with;

: open (INFILE, $thefile) || die "Sorry that file seems not to
: exist.\n";

: The || is the pel equivalent of or


   They are not equivalent.

   They are merely (sometimes) similar.

   At other times they give very different behavior.

   This is due to their different precendence.


: Some systems appear not accept or in this context.


   A perl that is more than about 3 years old will not accept 'or'.

   3 solar years old is about 120 computer years old.

   Astonishing that it is still kicking!


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 29 Jan 1999 17:55:04 -0600
From: "Kevin D. Chester" <chester@ma.ultranet.com>
To: birgitt@my-dejanews.com
Subject: Re: Newbie Shopping Cart Question
Message-Id: <36B24A57.2A08596F@ma.ultranet.com>

Hi B. Funk,

I see that you recommended Minivend to this person. Is it easy to install and
get up & running? What's the deal with it being a daemon (sp?). I visited on
of the sites that currently running  it and the site did minivend's version
of a "time out". Is this common or only with high traffic sites. Currently
I'm running a version of perlshop and like some of the options that I see in
minivend. In you opinion is minivend an upgrade or basically the same as what
I'm currently using?

Thanks for the input!

Kevin

birgitt@my-dejanews.com wrote:

> In article <36A7AB0D.67E86E93@sinewave.com>,
>   apoh@sinewave.com wrote:
> > I have written a lot of PERL code but all of it pretty simple, mainly
> > performing flat file DB operations and maintenance.  I'd like to get
> > real and interface a shopping cart with a SQL database.  I have heard
> > there are many shopping cart programs available for free download.  Can
> > someone recommend one that is a good match with PERL (whether or not I
> > have to buy it).
> >
> > Thanks in advance!!
> >
> >
>
> http://www.minivend.com
>
> B.Funk
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own





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

Date: 29 Jan 1999 22:38:16 GMT
From: jpa@pine.cse.nau.edu (John P. Abe (Rhialto))
Subject: NEWBIE: ok, I suck
Message-Id: <78td8o$3q1$1@ruby.ucc.nau.edu>

Ok, so I'm feeble. But please help me. The following simple snippet
of code is not executing. I could use sed, or tr, I know, but
I want to know why this doesn't work. Your insight appreciated.
All I'm trying to do is develop an interactive pattern-replacement
program, for self-education purposes.

#!/usr/bin/perl -w

print "What expression do you want to match?";
$outexp = <STDIN>;
chomp $outexp;

print "What is the new expression?";
$inexp = <STDIN>;
chomp $inexp;

print "What is the name of the input file? ";
$infile = <STDIN>;

open (READ, $infile) || die "Could not open file.\n";

while ($infile = <READ>) {
s/$outexp/$inexp/; 
print $infile;
}
close (READ);

Using a perl -w, I get the message that $outexp and $inexp are
not initialized within the loop. Is there some sort of scoping
issue I have overlooked?

Thanks.

John

--
eventually all things merge into one and a river runs through it -maclean
john abe     <+>     jpa@dreadnought.cse.nau.edu     <+>     plazmaworks  


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

Date: Fri, 29 Jan 1999 17:19:29 -0600
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: NEWBIE: ok, I suck
Message-Id: <36B24201.1304F087@us.ibm.com>

John P. Abe (Rhialto) wrote:

I forgot to mention.  -w should be complaining about this line also. 

> while ($infile = <READ>) {

while (defined( $infile = <READ> )) { 

-- 
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)


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

Date: Fri, 29 Jan 1999 17:15:22 -0600
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: NEWBIE: ok, I suck
Message-Id: <36B2410A.A374E03E@us.ibm.com>

John P. Abe (Rhialto) wrote:
 
> open (READ, $infile) || die "Could not open file.\n";
                       ^^
Typically you want to use "or" instead, although it doesn't matter in
this case.  Also, if you print out $!, you get the error message
explaining why your  open failed.

open READ, $infile or die "Error opening file: $!";


> while ($infile = <READ>) {
> s/$outexp/$inexp/;

This is operating on $_, which you haven't defined.

$infile =~ s/$outexp/$inexp/g;

Read about s///g if you're not sure what it does.  I think that you
intended to do it that way.

> print $infile;
> }
> close (READ);

Not a bad idea to check this one too.
close READ or die "Error closing file: $!";

> Using a perl -w, I get the message that $outexp and $inexp are
> not initialized within the loop. Is there some sort of scoping
> issue I have overlooked?

Nope, you just missed some of the documentation on <>.
perldoc perlop

-- 
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)


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

Date: 29 Jan 1999 15:20:34 PST
From: Cameron Kaiser <cdkaiser@delete.these.four.words.concentric.net>
Subject: Re: NEWBIE: ok, I suck
Message-Id: <78tfo2$hhk@chronicle.concentric.net>

jpa@pine.cse.nau.edu (John P. Abe (Rhialto)) writes:

>Ok, so I'm feeble. But please help me. The following simple snippet
>of code is not executing. I could use sed, or tr, I know, but
>I want to know why this doesn't work. Your insight appreciated.

>while ($infile = <READ>) {
>s/$outexp/$inexp/; 
>print $infile;
>}

Change to:

	while(<READ>) {
		s/$outexp/$inexp/;
		print;
	}

The s/ without '$infile =~' before it means it will occur to $_. Check your
documentation, as this would explain how $_ works. If you really want $infile
to have the current line from the READ filehandle, then

		$infile =~ s/$outexp/$inexp/;
		print $infile;

Again, this behaviour is documented.

--
Cameron Kaiser * cdkaiser.cris@com * powered by eight bits * operating on faith
  -- supporting the Commodore 64/128:  http://www.armory.com/~spectre/cwi/ --
   head moderator comp.binaries.cbm * cbm special forces unit $ea31 (tincsf)
personal page http://calvin.ptloma.edu/~spectre/ * "when in doubt, take a pawn"


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

Date: Fri, 29 Jan 1999 18:27:16 -0500
From: "Allan M. Due" <allan@due.net>
Subject: Re: NEWBIE: ok, I suck
Message-Id: <Gtrs2.144$L1.1845@nntp1.nac.net>

John P. Abe (Rhialto) wrote in message <78td8o$3q1$1@ruby.ucc.nau.edu>...
:Ok, so I'm feeble. But please help me. The following simple snippet
:of code is not executing. I could use sed, or tr, I know, but
:I want to know why this doesn't work. Your insight appreciated.
:All I'm trying to do is develop an interactive pattern-replacement
:program, for self-education purposes.
:
:#!/usr/bin/perl -w
:print "What expression do you want to match?";
:$outexp = <STDIN>;
:chomp $outexp;
:print "What is the new expression?";
:$inexp = <STDIN>;
:chomp $inexp;
:print "What is the name of the input file? ";
:$infile = <STDIN>;
:
:open (READ, $infile) || die "Could not open file.\n";


So far so good.

:while ($infile = <READ>) {
oops, you want to read the the data into the $infile variable?  That seems
strange to me.  But maybe that is what you want, seems unlikely though.

:s/$outexp/$inexp/;
Wait, there is no $_.  You used $infile instead.

:print $infile;

Ok, I hope you just want to print each line of the file as it was read in,
because that is what you are doing.
:}
:close (READ);
:
:Using a perl -w, I get the message that $outexp and $inexp are
:not initialized within the loop.

That is not what the error message said, that was how you interpreted it. ;-)
The error said use of uninitialzed variable.  $_ is uninitialized in this
case.

It is kind of hard to tell what you where trying to do.   If you were trying
to edit $infile on the fly, see the perlfaq.  Otherwise is this what you were
trying to do?

while (<READ>) {
    s/$outexp/$inexp/;
    print;
}
close (READ);

HTH

AmD




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

Date: Fri, 29 Jan 1999 23:35:11 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: NEWBIE: ok, I suck
Message-Id: <ebohlmanF6CHIn.1AB@netcom.com>

John P. Abe (Rhialto) <jpa@pine.cse.nau.edu> wrote:
: #!/usr/bin/perl -w

+1 brownie point for using -w, but -1 brownie point for not using strict.

: print "What expression do you want to match?";
: $outexp = <STDIN>;
: chomp $outexp;

: print "What is the new expression?";
: $inexp = <STDIN>;
: chomp $inexp;

: print "What is the name of the input file? ";
: $infile = <STDIN>;

What did you do twice above but forgot to do here?

: open (READ, $infile) || die "Could not open file.\n";

: while ($infile = <READ>) {
: s/$outexp/$inexp/;

With no binding operator, s/// works on $_.  What's $_ set to here?

It's entirely possible that $outexp is going to contain some characters 
that have special meanings in a regular expression (such as periods).  
Take a look at your perlop document, in the section on quoting operators, 
to find a way to keep this from being a problem.

 : print $infile;
: }
: close (READ);

: Using a perl -w, I get the message that $outexp and $inexp are
: not initialized within the loop. Is there some sort of scoping
: issue I have overlooked?

There doesn't appear to be, though two of the problems I mentioned are 
going to cause erratic behavior.  Are you sure this is the *exact* same 
code you're trying to run?  When posting code, you should cut-and-paste 
it in rather than retyping it; retyping can introduce errors that weren't 
in the original and lead readers on a wild goose chase and, less obvious 
but still important, can mask true errors; it's surprisingly easy to 
unconsciously correct an error while retyping.



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

Date: Fri, 29 Jan 1999 16:49:09 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Perl 5.002 on AIX ---> Perl 5.0x on MkLinux (Problems)
Message-Id: <fl_aggie-2901991649090001@aggie.coaps.fsu.edu>

In article <01be4ba7$7269a3a0$24948989@eric-sager.ca.boeing.com>, "Eric A.
Sager" <eric.a.sager@boeing.com> wrote:

+ If anyone has any experience with Perl on MkLinux 

Nope.

+ or other suggestions, I would welcome them...

Try:

$ perl
print "Hello, World!\n";
print "Goodbye, Cruel World!\n";
<control-d>

You should get those strings printed to the screen. You probably should run
a 'perl -v', too.

James


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

Date: Fri, 29 Jan 1999 21:16:41 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Perl Criticism
Message-Id: <36b72513.4701140@news.skynet.be>

You forgot a at least one checkmark:

I R A Aggie wrote:

> [ ] You posted a "YOU ALL SUCK" message

	Bart.


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

Date: Fri, 29 Jan 1999 21:40:52 GMT
From: topmind@technologist.com
Subject: Re: Perl Criticism
Message-Id: <78t9t3$9hj$1@nnrp1.dejanews.com>

In article <78rehg$l58$1@nnrp1.dejanews.com>,
  @l@ <aqumsieh@matrox.com> wrote:

[...]

> > I did not study them very well because frankly they confused the
> > heck out of me after page 3 or so of that chapture.
>
> They confused you, so you decided that they are not useful and that Perl is
> bad. At the risk of sounding redundant, maybe you should read some more on
> Perl before criticizing it.
>



Yes, they confused me, and I am NOT A DUMB PERSON!

If they confuse me, I guarentee they will confuse a good many
programmers, perhaps a majority.



> > I do not see much use in them anyhow except
> > to *compensate* for Perl's shortcommings, such as "leaky" parameter
> > passing and only 1 dimensional arrays (or lack
> > of table-orientedness).  (I love that word "leaky"!)
>
> Well, C's pointers are used to "compensate for leaky parameter passing".
> Multi-dimensional data structures in C are really 1 dimensional arrays of
> references (shh... don't tell anyone). Do you understand the concept of
> pointers? I believe not, since if you did, references would have been a
> breeze. If you didn't, then how the hell are you trying to design your own
> language??
>


Yes, I understand the concept of pointers. I have concluded
that pointers are UNNECESSARY in scripting languages.
ZERO NEED!!!! (Other than overcomming language weeknesses).

Pointers have their use for efficiency purposes, but not
for good program design.

Do you disagree with this statement.


> All this shows is your ignorance. You are proving every day what a bigger
> troll you are.
>


It shows YOUR ignorance. Show me ONE GOOD USE of pointers (other
than efficiency).

You hear that guys!? Another challenge for you to fail at or ignore.


> > It still does not violate the "subatomic level" that I talked about
> > on my web page. One can still tell what most of the peices (atoms) are
> > even if they cannot easily tell what they do.
>
> most??? what about all? some do violate your rules, but you choose to neglect
> them?
>


It is safer to say "most" instead of "all" because I cannot
guarentee all. There are too many lawyer wannabees in this
forum. I have to (try to) be careful with my language.


> Ok .. how does Perl code vialte that magical subatomic level? Do I have to
> visit your webpage? I won't. You can tell the exact type of every Perl with
> no effort at all. But .. why do I bother posting to this thread anyway?

Look at the Perl gunk people use for signitures. You are telling
me you can look at that and easily tell what are variables, routines,
parameters, what is being passed to each, etc?

Somebody ELSE around here recently agreed that Perl is more open
to abusability than other languages. If you disagree with
this, go argue with THEM first. Come back only when you win.

I would rather focus on pointers right now.


>
> --Ala
> $monger->{montreal}->[0];
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own
>

-tmind-
http://www.geocities.com/SiliconValley/Lab/6888/langopts.htm

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


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

Date: 29 Jan 1999 14:19:10 -0800
From: kirbyk@best.com (K. Krueger)
Subject: Re: Perl Criticism
Message-Id: <78tc4u$1n6$1@shell2.ba.best.com>

In article <78t9t3$9hj$1@nnrp1.dejanews.com>,
 <topmind@technologist.com> wrote:
>
>
>Yes, I understand the concept of pointers. I have concluded
>that pointers are UNNECESSARY in scripting languages.
>ZERO NEED!!!! (Other than overcomming language weeknesses).
>
(Perl is not a 'scripting' language, in the sense that shell programming
languages are.  But I'm convinced that arguing basic semantics with
topmind is a pointless operation.)

>Pointers have their use for efficiency purposes, but not
>for good program design.
>
>Do you disagree with this statement.
>
Yes.

>
>It shows YOUR ignorance. Show me ONE GOOD USE of pointers (other
>than efficiency).
>
>You hear that guys!? Another challenge for you to fail at or ignore.
>
When you're talking pointers in Perl, you're basically talking references.
I use these nearly every day in my programs, for a great variety of things.
They are decidedly not hard to use - I picked them up from the man pages
in about 10 minutes.  

Some good uses for references:
* Passing more than one complex parameter to a function (such as arrays and
hashes.)
* Object-oriented Perl uses references like crazy. (Whether or not OOP Perl is
good is another topic. I have my doubts.)
* Doing multi-dimensional arrays.  (Which you _can_ do in Perl with references.
And this is the same way that C does them.)
* Efficient argument passing. (You don't want to pass a hash of 10000 elements
around much.)
* Complex data structures, such as arrays of hashes, hashes of hashes, etc.
Anyone who has done a lot of programming will understand that sometimes a
well designed data structure can save you a lot of trouble, even if the
design itself is somewhat complex.  

These are fairly basic topics.  I don't want to even mention the advanced
magic you can do with references, like references to subroutines.

The claim that Perl would be better off without references is incredibly
absurd.  Sure, you may not need to use them, but they've helped me write
many programs, and even many basic programs.  They aren't an advanced
topic for things that are not meant to understand - they're a basic
way of manipulating data structures at the very core of modern perl.

-- 
Kirby Krueger      O-     kirbyk@best.com 
<*> "Most .sigs this small can't open their own jump gate."


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

Date: 29 Jan 1999 23:19:23 GMT
From: gorilla@elaine.drink.com (Alan Barclay)
Subject: Re: Perl Criticism
Message-Id: <917651962.268899@elaine.drink.com>

In article <78t9t3$9hj$1@nnrp1.dejanews.com>,
 <topmind@technologist.com> wrote:
>Yes, they confused me, and I am NOT A DUMB PERSON!

Are you sure about that?




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

Date: 29 Jan 1999 22:28:45 GMT
From: stursa@acns.fsu.edu (Scott Stursa)
Subject: Re: Perl Criticism
Message-Id: <78tcmt$o0n$1@news.fsu.edu>

Bart Lateur set Followup-To: thusly:

> Followup-To: alt.dev.null

so James' reply bounced into my E-Mail. I've let him know.


------------------------------------------------------------------------
Scott L. Stursa
"Sysadmin in Black" 
(see http://www.acns.fsu.edu/Technotes/No4/FSU/ )
FSU Academic Computing and Network Services


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

Date: Fri, 29 Jan 1999 23:18:41 GMT
From: lacpt97@my-dejanews.com
Subject: Perl Tk
Message-Id: <78tfk8$eo1$1@nnrp1.dejanews.com>

I get this error when installing perl Tk. cannot find c:\perl\lib/CORE/perl.h
any suggestions

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


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

Date: 29 Jan 1999 22:18:24 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: Problem printing nested string variables?
Message-Id: <78tc3g$6nl$2@news0-alterdial.uu.net>

Gary K. Nitzberg <gknitz@nitzspace.com> wrote:
> 
> I have global strings containing variables in local subroutines.  The string 
> in the code below prints;  "global  global."  I want to evaluate the string to 
> print "global local global".  What is the best way to do this?  TIA.

As someone else pointed out, Perl doesn't have "nested strings", it has
"string interpolation" -- ie. it's only done once.  You can achieve the
desired effect using eval:

  $code_string = 'global $joe global';         # note use of single quotes!

  sub nest {
     $joe = "local";
     print eval $code_string;
  }

If you don't understand why I'm using single quotes RTFM: "perldoc
perlop", search for "Quote and Quote-like Operators".  Also, when you
use eval you should *always* check $@ (error message, if any)
afterwards; 'perldoc -f eval' for details.

        Greg

-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


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

Date: 29 Jan 1999 13:33:22 -0700
From: "Eric The Read" <emschwar@mail.uccs.edu>
Subject: Re: Problem: IIS 4 doesn't pass URL path suffix to scripts
Message-Id: <xkfr9sdes4t.fsf@valdemar.col.hp.com>

"George Forman" <gforman@bigfoot.com> writes:
> Does anyone have a solution to the following problem?  IIS 4 chokes on
> running CGI scripts with URL path suffixes, that is, if you follow your
> script URL with any additional path, it's supposed to get passed to the
> script in the PATH_INFO environment variable, as in the following example
> (not served by IIS 4):

This is not a problem with Perl; in fact, I'd say this sounds like a web
server problem.  You should ask in the c.i.w.* newsgroups, where they
know about such things (and, incidentally, where it's relevant).

-=Eric


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

Date: Fri, 29 Jan 1999 23:51:30 GMT
From: jimmy <jimmy@globalSpam.org>
Subject: Re: regex lib or Perl linked in?
Message-Id: <36B24798.ADFA5B3@globalSpam.org>

I'm gonna check this site. Thanks, Greg.


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

Date: Fri, 29 Jan 1999 22:08:09 GMT
From: hal <halxd2@my-dejanews.com>
Subject: Re: SED command in PERL through HTML
Message-Id: <78tbg1$b2s$1@nnrp1.dejanews.com>

In article <78si9f$imo$1@nnrp1.dejanews.com>,
  smanand@my-dejanews.com wrote:
> I am trying to execute a "sed" command in a UNIX PERL script which
> is called by a HTML form file as below.
>
> $x1 = `sed -f one.txt two.txt > three.txt`;
> print $x1;
>
> one.txt is the sed command file
> two.txt is the file to be worked on
> three.txt is the output file
>
> The above works if I execute the above sed command from my UNIX shell
> prompt.  It copies two.txt to three.txt (without executing sed) if I
> execute the above through PERL HTML.
>
Not to be a butthead, butt, perl can do the sed script. I was useing
sed to do a lot of work. Perl does it better for me. Send me your sed
script and I'll try to perl it.
The real problem might be the path to sed needs to be absolute.
/usr/bin/sed -f script ...

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


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

Date: Fri, 29 Jan 1999 23:08:44 GMT
From: tommy927@my-dejanews.com
Subject: Re: strange behaviour with tr///
Message-Id: <78tf1l$e80$1@nnrp1.dejanews.com>

Problem solved (cause unknown).  I took out that line and retyped it and it
works now.  I think there *may* have been a character embedded somehere that I
couldn't see, I don't know.  But it is working now...strange

Thanks
Tommy

In article <78sv9a$45p$1@pegasus.csx.cam.ac.uk>,
  mjtg@cus.cam.ac.uk (M.J.T. Guy) wrote:
> Uri Guttman  <uri@home.sysarch.com> wrote:
> >>>>>> "t" == tommy927  <tommy927@my-dejanews.com> writes:
> >
> >  t> while (<>) {
> >  t>     tr/a-mA-Mn-zN-Z/n-zN-Za-mA-M/;
> >  t>     print;
> >  t> }
> >
> >  t> It works with everything i throw at it but when i try an underscore
> >  t> (_), it returns M, which is kinda unexpected.  I am using Perl
> >  t> 5.004
> >
> >what would you want it to return?
> >
> >from perlop on tr///:
> >
> >Otherwise, if the REPLACEMENTLIST is shorter than the SEARCHLIST, the
> >final character is replicated till it is long enough.
>
> But those two lists are the same length.   So that doesn't apply.
>
> And when I try the given code, it works OK, both under perl5.004 and
> under a modern Perl.
>
> So something else is going on.
>
> Mike Guy
>

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


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

Date: Fri, 29 Jan 1999 14:48:16 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: string to integer conversion
Message-Id: <x3y679px3lq.fsf@tigre.matrox.com>


"James" <mayo98@portalinc.com> writes:

> Hi.. I'm new to perl. I would like to know how will i Convert a string
> number "47" to integer number 47 ?? For example, I have this program that
> adds 2 to "47". So i have to convert "47" to 47 then add 2 to make it 49
> then convert it back to "49" string.. how ??

Why does this question get asked at least once a week?
Anway, the answer is, you don't need to do any explicit
conversion. Perl does not have unique integer types or character
types. They are lumped up into one type, scalars. Depending on the
operation, scalars are either treated as integers or strings. Example:

$a = "47";      # $a is a string now

$b = $a + 4;    # $b is the number 51 now
                # $a was treated like a number

$c = "The number is " . $a; # $c is "The number is 47"
                            # $a was treated like a string

$d = "aaaz";   # $d is a string
$d++;          # now $d is "aaba"

Conclusion: just do whatever you want to. Perl will figure it out for
you.

Hmm.. this sounds like a good new slogan for Perl .. no?

Hope this helps,
Ala



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

Date: Fri, 29 Jan 1999 20:59:54 GMT
From: satkinson@freemarkets.com
To: satkinson@freemarkets.com
Subject: URGENT: Find and Replace in Registry using Perl
Message-Id: <78t7g3$78v$1@nnrp1.dejanews.com>

Is there a way in perl to do a find and replace of registry values, or parts
of registry values?

Please email: satkinson@freemarkets.com

TIA,
Scott

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


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

Date: 29 Jan 1999 13:25:06 PST
From: Cameron Kaiser <cdkaiser@delete.these.four.words.concentric.net>
Subject: Re: Using Perl to interrogate Hotmail
Message-Id: <78t8vi$kht@journal.concentric.net>

Barb - perlgirl <perlquestions@yahoo.com> writes:

>I want to write something that will log into my hotmail and yahoo accounts
>and identify whether I have any new messages.  I normally set up an account
>on one or the other for each project on which I work (I do a little
>consulting) and it's a pain after awhile to log into 8-9 accounts each day. 
>I have been noodling with a couple Perl libraries, but haven't figured out
>where to look for code that will help me through the login, etc.

Unless Hotmail and Yahoo have POP (which I don't know, I don't use them),
you would need to figure out how the web browser logs in. Download the HTML
pages making up your login screen and your mailbox and see what fields are
in use, or what queries the web browser makes of the server. Then use LWP to
imitate the browser making these queries. Easily said (not done), but it's
a matter of figuring out their peculiar little system.

--
Cameron Kaiser * cdkaiser.cris@com * powered by eight bits * operating on faith
  -- supporting the Commodore 64/128:  http://www.armory.com/~spectre/cwi/ --
   head moderator comp.binaries.cbm * cbm special forces unit $ea31 (tincsf)
personal page http://calvin.ptloma.edu/~spectre/ * "when in doubt, take a pawn"


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

Date: Fri, 29 Jan 1999 16:51:23 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Using Perl to interrogate Hotmail
Message-Id: <fl_aggie-2901991651230001@aggie.coaps.fsu.edu>

In article <78t356$38n$1@nnrp1.dejanews.com>, Barb - perlgirl
<perlquestions@yahoo.com> wrote:

+ I have been noodling with a couple Perl libraries, but haven't figured out
+ where to look for code that will help me through the login, etc.

perldoc LWP
perldoc lwpcook

This is something I'd like to try, but haven't had time. Let me know how
far you get, and if you run into problems.

James


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

Date: Fri, 29 Jan 1999 18:43:42 -0500
From: "Allan M. Due" <allan@due.net>
Subject: Re: Visitor email! How?
Message-Id: <2Jrs2.146$L1.1904@nntp1.nac.net>

dragnovich@my-dejanews.com wrote in message
<78t4g0$4dq$1@nnrp1.dejanews.com>...
:Hello I have a NT server and IIS 3.0 (not my best choice)
:
:Well suffing on the net I enter to Microsoft webpage and I say hey lets!
:subscribe my self to the MS developers network!
:
:When I enter my data I never put my email but in one time IS SEE MY EMAIL on
:a filed! How can they do this??? Some frind tell me that he is reciving email
:from other companies like CNN and others... so I think it is the same thing.


It is a well known fact that Micro$oft has recently purchased the Psychic
Friends Network as part of their overall internet strategy.  The positive
response by the press to this purchase was the catalyst behind the recently
announced decision to split their stock.

You will be assimilated.

HTH

AmD





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

Date: Fri, 29 Jan 1999 16:54:14 -0500
From: Paul Bruno <paullyb8@fnol.net>
Subject: Re: Win32: passing values into functions
Message-Id: <36B22E06.99A13716@fnol.net>

Oh!  Boy, I must not be able to see right; I couldn't tell if the book said @_,
or @__ as the varible for passing values into functions!  Oh boy!  Man, that
clears up a lot!  If I am wrong, please correct me, but I sure don't think I
am!

Matthew Bafford wrote:

> On Thu, 28 Jan 1999 22:29:07 -0500, Paul Bruno <paullyb8@fnol.net> wrote:
> [snip]
> -> function, it is stored in the default @__ varible.  Well, when I was
>
> s/\@__/\@_/;
>
> I don't have a LLama, so I can't say if it's a bug or a braino.
>
> [snip]
> -> was given to the @__ varible.  So my question is this:  What does Active
> -> Perl give the passed-on value to?  What varible does it store it in?
>
> AS Perl is almost identical to the main dist.  The only major differences
> are to work around Win32 limitations.
>
> -> Thanks for the help!
>
> HTH!
>
> --Matthew



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

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

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