[16977] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4389 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 20 18:10:38 2000

Date: Wed, 20 Sep 2000 15:10:25 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <969487825-v9-i4389@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 20 Sep 2000     Volume: 9 Number: 4389

Today's topics:
    Re: How to call a Perlscript ( SSI ) within a Javascrip <gcf@my-deja.com>
    Re: How to Capture Specific Whitespace? (Dave Sherohman)
    Re: How to Capture Specific Whitespace? <lr@hpl.hp.com>
    Re: How to Capture Specific Whitespace? <godzilla@stomp.stomp.tokyo>
    Re: How to Capture Specific Whitespace? (Dave Sherohman)
    Re: How to install perl in win98? <bhoran@gate.net>
        How to mail from somebody besides 'Nobody' in perl nickysantoro@my-deja.com
    Re: How to mail from somebody besides 'Nobody' in perl (Dave Sherohman)
    Re: I need help with arrays. (Gwyn Judd)
        Interpolation on the fly (Dave Sherohman)
    Re: Interpolation on the fly (Gwyn Judd)
    Re: Interpolation on the fly (Jerome O'Neil)
    Re: Is this terribly inefficient? <lr@hpl.hp.com>
        Joining strings <g.soper@soundhouse.co.uk>
    Re: Joining strings <lr@hpl.hp.com>
    Re: Joining strings (Gwyn Judd)
    Re: kill a process in Win32 filosmith@my-deja.com
    Re: kill a process in Win32 filosmith@my-deja.com
    Re: kill a process in Win32 filosmith@my-deja.com
        literal substitution derf_up@yahoo.com
    Re: literal substitution <dmitryp@attglobal.net>
    Re: literal substitution (Richard J. Rauenzahn)
    Re: literal substitution (Logan Shaw)
    Re: loop through file - how to loop back one line? (Garry Williams)
        Newbie Ques. Text Limits? <bgy1@is2.nyu.edu>
    Re: Newbie Ques. Text Limits? <glynFOOdwr@FSCKdeleteEmeD.co.uk>
    Re: Newbie Ques. Text Limits? <bgy1@is2.nyu.edu>
    Re: Newbie Ques. Text Limits? <amonotod@netscape.net>
    Re: Newbie Ques. Text Limits? <glynFOOdwr@FSCKdeleteEmeD.co.uk>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 20 Sep 2000 21:25:14 GMT
From: A. Nonomous <gcf@my-deja.com>
Subject: Re: How to call a Perlscript ( SSI ) within a Javascript ?
Message-Id: <8qb9v0$lts$1@nnrp1.deja.com>

It doesn't work because Javascript is a client-side scripting language.
Perlscript is a server-side language.

I have done this though on IIS and an ASP page:
----- code snipit -------
  <SCRIPT LANGUAGE="PerlScript" RUNAT="Server">
    sub getname(){
      use Socket;
      $ip = pop(@_); #Get parameters
      @i=split(/\./,$ip);
      $ad=pack("C4",$i[0],$i[1],$i[2],$i[3]);
      ($n,$al,$ad,$ln,@addrs)=gethostbyaddr($ad,2);
      return $n;
    }
  </SCRIPT>
----- code snipit -------
----- code snipit -------
    <TD>Your Machine Name</TD>
    <TD><INPUT NAME="name" TYPE="TEXT" SIZE="40" MAXLENGTH="100"
    <%
       dim n
       n=getname(request.servervariables("REMOTE_ADDR"))
       response.write "value=" & chr(34) & n & chr(34)
    %>
    ></TD></TR>
----- code snipit -------
Maybe that will give you some ideas.
--
gcf

In article <8qarja$oc$1@duba04h09-0.dplanet.ch>,
  "dplanet" <whofer@dplanet.ch> wrote:
> Hi
> can anybody help me ? I would like to call a Perlscript, exactly
> a Server Site Include within a Javascript. The Perlscript is
> running on a web server. How can i do that. I tried with following
code
> without success !  What is wrong ?
>
> <html>
> <head>
> <script language="JavaScript">
> function test () {
> document.write("<!-- #exec cgi='cgi-bin/test3.pl' -->");
> }
> </script>
> </head>
> <body>
> <script>
> test();
> </script>
> </body>
> </html>
>
> The Perlscript is not called !!  Why  ??
>
> Thanks a lot for your help in advance
> Werner
>
>

--
--
gcf


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 20 Sep 2000 18:17:22 GMT
From: esper@news.visi.com (Dave Sherohman)
Subject: Re: How to Capture Specific Whitespace?
Message-Id: <slrn8shvph.nl2.esper@pchan.dojo>

On Wed, 20 Sep 2000 17:47:28 GMT, beach9000@hotmail.com <beach9000@hotmail.com> wrote:
> so that I could reproduce the whitespace, either by simply copying the
> space, or know how many characters of whitespace exists.

if $my_data =~ m/(\s+)/ { $whitespace = $1 }
else                    { $whitespace = '' }

-- 
"Two words: Windows survives." - Craig Mundie, Microsoft senior strategist
"So does syphillis. Good thing we have penicillin." - Matthew Alton
Geek Code 3.1:  GCS d- s+: a- C++ UL++$ P+>+++ L+++>++++ E- W--(++) N+ o+
!K w---$ O M- V? PS+ PE Y+ PGP t 5++ X+ R++ tv b+ DI++++ D G e* h+ r++ y+


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

Date: Wed, 20 Sep 2000 12:56:18 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How to Capture Specific Whitespace?
Message-Id: <MPG.1432b63c97c905b198ada1@nntp.hpl.hp.com>

In article <slrn8shvph.nl2.esper@pchan.dojo> on Wed, 20 Sep 2000 
18:17:22 GMT, Dave Sherohman <esper@news.visi.com> says...
> On Wed, 20 Sep 2000 17:47:28 GMT, beach9000@hotmail.com <beach9000@hotmail.com> wrote:
> > so that I could reproduce the whitespace, either by simply copying the
> > space, or know how many characters of whitespace exists.
> 
> if $my_data =~ m/(\s+)/ { $whitespace = $1 }
> else                    { $whitespace = '' }

  my ($whitespace) = $my_data =~ /(\s*)/;

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


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

Date: Wed, 20 Sep 2000 13:12:14 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: How to Capture Specific Whitespace?
Message-Id: <39C91A1E.A1F0790A@stomp.stomp.tokyo>

beach9000@hotmail.com wrote:
 
> I'm looking to 'capture' to amount of white space 
> before a piece of text.

>    garbagetext      markertext
>               ^----|


>    [start of file]           markertext
>    ^------------------------|

>    blah blah blah    blah    markertext
>                          ^--|

> so that I could reproduce the whitespace, either by 
> simply copying the space, or know how many characters
> of whitespace exists.



User configuration is $key_word in my test script.


You may capture spaces or lack of any spaces by simply:

  if ($string =~ /(\s*)$key_word/)
   { $spaces = $1; }


However, using this type of Perl 5 Cargo Cult weenie code,
will not work as you expect. If you are smart, you will
be exceptionally cautious about using stereotypical
Perl 5 Cargo Cult code posted in this newsgroup. It
is quite common for this type of code to not work
correctly as you will note by glancing over my 
test script.


* laughs *

Ahhh... so much innocence lost by earning
this nickname, Goddess of Hackers.


Godzilla!
-- 
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class



TEST SCRIPT:
____________


#!/usr/local/bin/perl

print "Content-Type: text/plain\n\n";

$key_word = "markertext";

$string = "   garbagetext       markertext";

&Do_It;

$string = "                    markertext";

&Do_It;

$string = "   blah blah blah    blah    markertext";

&Do_It;

$string = "  blah blah  blahmarkertext";

&Do_It;

$string = "markertext";

&Do_It;

$string = "Godzilla Rocks!";

&Do_It;

$string = "markertext Godzilla Rocks! markertext";

&Do_It;


sub Do_It
 {
  print "Input:\n  $string\n";

  if ($string =~ /$key_word.*$key_word/)
   { print "Multiple instances of Key Word '$key_word' found."; exit; }

  elsif ($string =~ /(\s+)$key_word/)
   { 
    my ($count) = $1;
    $count = $count =~ tr/ //;
    print "Number of spaces preceeding Key Word '$key_word': $count\n\n";
   }

  elsif ($string =~ /[^ ]$key_word/)
   { print "No spaces found preceeding Key Word '$key_word'.\n\n"; }

  elsif ($string =~ /^$key_word/)
   { print "Keyword '$key_word' found at beginning of line.\n\n"; }

  else
   { print "Keyword '$key_word' not found.\n\n"; }
 }

exit;



PRINTED RESULTS:
________________


Input:
     garbagetext       markertext
Number of spaces preceeding Key Word 'markertext': 7

Input:
                      markertext
Number of spaces preceeding Key Word 'markertext': 20

Input:
     blah blah blah    blah    markertext
Number of spaces preceeding Key Word 'markertext': 4

Input:
    blah blah  blahmarkertext
No spaces found preceeding Key Word 'markertext'.

Input:
  markertext
Keyword 'markertext' found at beginning of line.

Input:
  Godzilla Rocks!
Keyword 'markertext' not found.

Input:
  markertext Godzilla Rocks! markertext
Multiple instances of Key Word 'markertext' found.


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

Date: Wed, 20 Sep 2000 21:24:10 GMT
From: esper@news.visi.com (Dave Sherohman)
Subject: Re: How to Capture Specific Whitespace?
Message-Id: <slrn8sianq.npj.esper@pchan.dojo>

On Wed, 20 Sep 2000 12:56:18 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
> In article <slrn8shvph.nl2.esper@pchan.dojo> on Wed, 20 Sep 2000 
> 18:17:22 GMT, Dave Sherohman <esper@news.visi.com> says...
> > On Wed, 20 Sep 2000 17:47:28 GMT, beach9000@hotmail.com <beach9000@hotmail.com> wrote:
> > > so that I could reproduce the whitespace, either by simply copying the
> > > space, or know how many characters of whitespace exists.
> > 
> > if $my_data =~ m/(\s+)/ { $whitespace = $1 }
> > else                    { $whitespace = '' }
> 
>   my ($whitespace) = $my_data =~ /(\s*)/;

Nope.  With \s*, it never returns any any non-leading whitespace.  (Every
string starts with 0 or more whitespace characters...)

With \s+, strings containing no whitespace leave $1 undefined, which is why
the 'if' is there.

-- 
"Two words: Windows survives." - Craig Mundie, Microsoft senior strategist
"So does syphillis. Good thing we have penicillin." - Matthew Alton
Geek Code 3.1:  GCS d- s+: a- C++ UL++$ P+>+++ L+++>++++ E- W--(++) N+ o+
!K w---$ O M- V? PS+ PE Y+ PGP t 5++ X+ R++ tv b+ DI++++ D G e* h+ r++ y+


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

Date: Wed, 20 Sep 2000 16:02:19 -0400
From: Brian Horan <bhoran@gate.net>
To: jason <elephant@squirrelgroup.com>
Subject: Re: How to install perl in win98?
Message-Id: <Pine.A41.4.21.0009201601370.12800-100000@dakota.gate.net>

OR, you could install Linux or UNIX and ./configure, make, make install...



   ~             
  'v'   Brian Horan
 // \\  Systems Analyst/Administrator/Programmer 
/(   )\ Miami Herald Publishing Company		 bhoran@herald.com
 ^`~'^   
Linux: For when you're sick of CTRL-ALT-DEL

On Tue, 19 Sep 2000, jason wrote:

> EE <ting80427@hotmail.com> wrote ..
> >I've download the Perl-5.6.0 and window installer from activestate.com and
> >install it,but how can i install the perl?
> 
> umm .. once the installer is installed you just run the .msi file 
> (double-click it) .. should be called something like
> 
>   ActivePerl-5.6.0.613.msi
> 
> -- 
>   jason -- elephant@squirrelgroup.com --
> 



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

Date: Wed, 20 Sep 2000 19:03:15 GMT
From: nickysantoro@my-deja.com
Subject: How to mail from somebody besides 'Nobody' in perl
Message-Id: <8qb1l2$auc$1@nnrp1.deja.com>

I am using a simple
open MAIL, "|mail $recpient";
print MAIL "blah";

to send email confirmations from a web based form. How do I
send this mail from somebody besides 'Nobody'?
Thanks for any help,


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 20 Sep 2000 19:25:26 GMT
From: esper@news.visi.com (Dave Sherohman)
Subject: Re: How to mail from somebody besides 'Nobody' in perl
Message-Id: <slrn8si3p6.nl2.esper@pchan.dojo>

On Wed, 20 Sep 2000 19:03:15 GMT, nickysantoro@my-deja.com <nickysantoro@my-deja.com> wrote:
> I am using a simple
> open MAIL, "|mail $recpient";
> print MAIL "blah";
> 
> to send email confirmations from a web based form. How do I
> send this mail from somebody besides 'Nobody'?

If you're going through the 'mail' command, I'm pretty sure you can't - it
knows what user called it and sets the From: accordingly.

However, you can talk to sendmail directly instead...  (Since you're using
mail, I'm assuming its on a *nix system.  Note that this will generally work
even if you're dealing with an MTA other than sendmail, since most other MTAs
will have a symlink from 'sendmail' to the actual MTA and are compatible with
sendmail options.)

      open (MAIL, "| $sendmail") || die "Can't call sendmail";
      my $oldhandle = select MAIL;

      print "To: $notify_to\n";
      print "From: $appname\n";
      print "Subject: $subject\n";
      print "\n";
      print "$message\n";
      close(MAIL);

      select $oldhandle;

You can insert any other headers you like, of course.  Just be sure to put a
blank line after them.

-- 
"Two words: Windows survives." - Craig Mundie, Microsoft senior strategist
"So does syphillis. Good thing we have penicillin." - Matthew Alton
Geek Code 3.1:  GCS d- s+: a- C++ UL++$ P+>+++ L+++>++++ E- W--(++) N+ o+
!K w---$ O M- V? PS+ PE Y+ PGP t 5++ X+ R++ tv b+ DI++++ D G e* h+ r++ y+


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

Date: Wed, 20 Sep 2000 20:37:42 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: I need help with arrays.
Message-Id: <slrn8si80i.1tk.tjla@thislove.dyndns.org>

I was shocked! How could Abigail <abigail@foad.org>
say such a terrible thing:

>    $ perl -MCoy -wle 'print $]'
>    5.006
>    $
>
>
>Perhaps I should release an updated version. ;-)

Oh pretty please do

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
McGowan's Madison Avenue Axiom:
	If an item is advertised as "under $50", you can bet it's not
	$19.95.


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

Date: Wed, 20 Sep 2000 21:29:29 GMT
From: esper@news.visi.com (Dave Sherohman)
Subject: Interpolation on the fly
Message-Id: <slrn8sib1o.npj.esper@pchan.dojo>

How do you perform late (i.e., on use rather than assignment) interpolation
of variables into strings?

What I want to do is:

$fmt = 'User: $user';
print $fmt;           # prints "User: "
$user = 'tom';
print $fmt;           # "User: tom"
$user = 'dick;
print $fmt;           # "User: dick"
$user = 'harry';
print $fmt;           # "User: harry"

What I get, all 4 times, is "User: $user".

Can this be done using variable interpolation or will I have to resort to
copying $fmt and using s/// to explicitly insert the name each time?

-- 
"Two words: Windows survives." - Craig Mundie, Microsoft senior strategist
"So does syphillis. Good thing we have penicillin." - Matthew Alton
Geek Code 3.1:  GCS d- s+: a- C++ UL++$ P+>+++ L+++>++++ E- W--(++) N+ o+
!K w---$ O M- V? PS+ PE Y+ PGP t 5++ X+ R++ tv b+ DI++++ D G e* h+ r++ y+


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

Date: Wed, 20 Sep 2000 21:44:44 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Interpolation on the fly
Message-Id: <slrn8sibu9.1tk.tjla@thislove.dyndns.org>

I was shocked! How could Dave Sherohman <esper@news.visi.com>
say such a terrible thing:
>How do you perform late (i.e., on use rather than assignment) interpolation
>of variables into strings?
>
>What I want to do is:
>
>$fmt = 'User: $user';
>print $fmt;           # prints "User: "
>$user = 'tom';
>print $fmt;           # "User: tom"
>$user = 'dick;
>print $fmt;           # "User: dick"
>$user = 'harry';
>print $fmt;           # "User: harry"
>
>What I get, all 4 times, is "User: $user".
>
>Can this be done using variable interpolation or will I have to resort to
>copying $fmt and using s/// to explicitly insert the name each time?

No you should be right to use interpolation. The magic you are looking
for is called "eval". See the documentation:

perldoc -f eval

$fmt = '"User: $user\n"';
print eval $fmt;
$user = 'tom';
print eval $fmt;

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Out of my mind. Back in five minutes.


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

Date: Wed, 20 Sep 2000 21:55:44 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: Interpolation on the fly
Message-Id: <Anay5.663$zo2.266258@news.uswest.net>

esper@news.visi.com (Dave Sherohman) elucidates:
> How do you perform late (i.e., on use rather than assignment) interpolation
> of variables into strings?
> 
> What I want to do is:
> 
> $fmt = 'User: $user';
> print $fmt;           # prints "User: "
> $user = 'tom';
> print $fmt;           # "User: tom"
> $user = 'dick;
> print $fmt;           # "User: dick"
> $user = 'harry';
> print $fmt;           # "User: harry"
> 
> What I get, all 4 times, is "User: $user".

Which is exactly what you should get.  Single quotes are not
interpolated, so your scalar $user is not being treated as such.

#!/usr/local/bin/perl -w
use strict;

my $singles = 'User: $user';

print $singles, qq{\n};

my $user = 'joe';
my $dubs = "User: $user";

print $dubs;

> 
> Can this be done using variable interpolation or will I have to resort to
> copying $fmt and using s/// to explicitly insert the name each time?
> 

Nope.  You should read up on Perl syntax, though.  

-- 
"Civilization rests on two things: the discovery that fermentation 
produces alcohol, and the voluntary ability to inhibit defecation.  
And I put it to you, where would this splendid civilization be without 
both?" --Robertson Davies "The Rebel Angels" 


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

Date: Wed, 20 Sep 2000 12:02:12 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Is this terribly inefficient?
Message-Id: <MPG.1432a98b45ce0df898ad9e@nntp.hpl.hp.com>

In article <orngsso9jqtkl8ipt52eppdrem6tafp81k@4ax.com> on Wed, 20 Sep 
2000 07:01:44 GMT, Bart Lateur <bart.lateur@skynet.be> says...
> Larry Rosler wrote:
> 
> >String comparison is O(N) in the length of the strings being compared, 
> >which becomes a multiplicative factor in the O(N log N) comparisons.
> 
> No. Or yes. Or...  Anyway: it's *not the name N*. So, let's call it M: M
> is the average string length. N is the number of array items.

Yes.  It is O(M) * O(N log N).

> For floating point comparison, M = 12 may be enough. Compare that to 4
> to 8 bytes for the packed number. That's not an earth-shattering
> difference.

Remember that the essence of the GRT is comparing strings 
lexicographically, which is a bear for arbitrary floating-point numbers 
unless they are packed into big-endian binary.

As for 'earth-shatering difference', I agree that it's not.  But we are 
trying to squeeze everything out of the O(N log N) sort comparisons, so 
it shouldn't be ignored.

I now find it as easy to write pack() formats for integers as it is to 
write sprintf() formats.  Needless to say, the latter are easier to 
read, and Uri prefers them.  The paper shows both.

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


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

Date: Wed, 20 Sep 2000 21:30:41 +0100
From: Geoff Soper <g.soper@soundhouse.co.uk>
Subject: Joining strings
Message-Id: <4a01294e63g.soper@soundhouse.co.uk>

I have a string which contains the location of a directory:

$location = "/home/database/";

Later on I want to take the file '/home/database/file' and rename it to
'/home/database/new_name'. I was under the impression that:

rename ($location . "file",$location . "new_name");

would do the job. Apparently not!

Similarly to open the first file will the following work?

open (FILE, ">$location . 'file'");

What's the correct way to join two strings to achieve what I require?

Many thanks

-- 
Geoff Soper
g.soper@soundhouse.co.uk
Take a look at the Soundhouse page http://www.soundhouse.co.uk/


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

Date: Wed, 20 Sep 2000 13:51:53 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Joining strings
Message-Id: <MPG.1432c3406758f13498ada3@nntp.hpl.hp.com>

In article <4a01294e63g.soper@soundhouse.co.uk> on Wed, 20 Sep 2000 
21:30:41 +0100, Geoff Soper <g.soper@soundhouse.co.uk> says...
> I have a string which contains the location of a directory:
> 
> $location = "/home/database/";
> 
> Later on I want to take the file '/home/database/file' and rename it to
> '/home/database/new_name'. I was under the impression that:
> 
> rename ($location . "file",$location . "new_name");
> 
> would do the job. Apparently not!

Perl would tell you why not, if you tested for failure of the operation 
and printed a diagnostic that included $!.  The reason doesn't have to 
do with string concatenation.  Your way works fine, and there are many 
other ways too.

> Similarly to open the first file will the following work?
> 
> open (FILE, ">$location . 'file'");
> 
> What's the correct way to join two strings to achieve what I require?

  open FILE, ">${location}file" or
    die "Couldn't open '${location}file'. $!\n";

The curly brackets separate the symbol $location from the desired 
suffix.  Many would leave the trailing '/' off of $location, and use it 
as a separator:

         ... ">$location/file" ...

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


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

Date: Wed, 20 Sep 2000 20:55:08 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Joining strings
Message-Id: <slrn8si919.1tk.tjla@thislove.dyndns.org>

I was shocked! How could Geoff Soper <g.soper@soundhouse.co.uk>
say such a terrible thing:
>I have a string which contains the location of a directory:
>
>$location = "/home/database/";
>
>Later on I want to take the file '/home/database/file' and rename it to
>'/home/database/new_name'. I was under the impression that:
>
>rename ($location . "file",$location . "new_name");

A system call can always fail although I see nothing wrong with the way
you are calling it. I would check for an error return though so you can
see why it is failing:

rename (blah blah) or die "Could not move the file: $!";

>would do the job. Apparently not!
>
>Similarly to open the first file will the following work?
>
>open (FILE, ">$location . 'file'");
>
>What's the correct way to join two strings to achieve what I require?

try:

open FILE, ">$location" . 'file' or die "Could not open the file: $!";

or

open FILE, ">${location}file" or die "Arrgh: $!";

Again note the checking for an error.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
"All my friends and I are crazy.  That's the only thing that keeps us
sane."


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

Date: Wed, 20 Sep 2000 18:46:45 GMT
From: filosmith@my-deja.com
Subject: Re: kill a process in Win32
Message-Id: <8qb0md$9n9$1@nnrp1.deja.com>


> I use utility kill and tlist from the resource kit. it works quite
well.
>
> I don't understand why there are no equivalent function of "tlist"
in the
> win32:process module.

the Win32::PerfLib module may be what you're looking for. You can copy
and paste right out of the example and it returns a list of process
names and IDs.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 20 Sep 2000 19:49:55 GMT
From: filosmith@my-deja.com
Subject: Re: kill a process in Win32
Message-Id: <8qb4cp$eff$1@nnrp1.deja.com>


>
> the Win32::PerfLib module may be what you're looking for. You can copy
> and paste right out of the example and it returns a list of process
> names and IDs.


Wait, no it doesn't. I'm dumb.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 20 Sep 2000 20:09:50 GMT
From: filosmith@my-deja.com
Subject: Re: kill a process in Win32
Message-Id: <8qb5hs$fv3$1@nnrp1.deja.com>


> > the Win32::PerfLib module may be what you're looking for. You can
copy
> > and paste right out of the example and it returns a list of process
> > names and IDs.
>
> Wait, no it doesn't. I'm dumb.

yes it does, i think. that's all i have to say on that subject.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 20 Sep 2000 19:48:24 GMT
From: derf_up@yahoo.com
Subject: literal substitution
Message-Id: <8qb49v$eea$1@nnrp1.deja.com>

Hi,
I would like to create a series of arrays, (probably using a for loop
and $counter++) (i.e. @array1, @array2, @array3, etc…).  I have always
called this a "literal substitution", but someone else called it
a "symbolic reference".  In either case in not seeing how to do this in
any of the O'Reilly books (Camel, Lama, Ram, or Puma).  Maybe it's
called something else?

for ($counter = 0; $counter <100; $counter++) {
	@array???$counter???
}

I'm sure there are other ways around my "real" problem, but this is the
approach I want to take.  Any suggestions on the syntax for this
approach?  Thanks
-Fred


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 20 Sep 2000 16:31:41 -0400
From: "Dmitry Podborits" <dmitryp@attglobal.net>
Subject: Re: literal substitution
Message-Id: <39c91dd5$0$22127@wodc7nh6.news.uu.net>

If you need to create one "group" array containing all the elements of
"individual" arrays, you can simply do :

my @a = ( @a1, @a2, @a3 );

You can also "append" them one to another as in:

push @a1, @a2, @3, ... @aN; # Now @a1 contains all your arrays

<derf_up@yahoo.com> wrote in message news:8qb49v$eea$1@nnrp1.deja.com...
> Hi,
> I would like to create a series of arrays, (probably using a for loop
> and $counter++) (i.e. @array1, @array2, @array3, etc.).  I have always
> called this a "literal substitution", but someone else called it
> a "symbolic reference".  In either case in not seeing how to do this in
> any of the O'Reilly books (Camel, Lama, Ram, or Puma).  Maybe it's
> called something else?
>
> for ($counter = 0; $counter <100; $counter++) {
> @array???$counter???
> }
>
> I'm sure there are other ways around my "real" problem, but this is the
> approach I want to take.  Any suggestions on the syntax for this
> approach?  Thanks
> -Fred
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

Date: 20 Sep 2000 21:32:31 GMT
From: nospam@hairball.cup.hp.com (Richard J. Rauenzahn)
Subject: Re: literal substitution
Message-Id: <969485551.107820@hpvablab.cup.hp.com>



derf_up@yahoo.com writes:
>for ($counter = 0; $counter <100; $counter++) {
>	@array???$counter???
>}
>
>I'm sure there are other ways around my "real" problem, but this is the
>approach I want to take.  Any suggestions on the syntax for this
>approach?  Thanks

Would you mind taking a different approach?  A list of lists would be
the best way to do this.  'man perllol'.

If you insist on using symbolic references (ick!!), then read up on the
perlref man page.

Rich
p.s. An easier way to express that for loop would be for (1..100).
-- 
Rich Rauenzahn ----------+xrrauenza@cup.hp.comx+ Hewlett-Packard Company
Technical Consultant     | I speak for me,     |   19055 Pruneridge Ave. 
Development Alliances Lab|            *not* HP |                MS 46TU2
ESPD / E-Serv. Partner Division +--------------+---- Cupertino, CA 95014


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

Date: 20 Sep 2000 16:40:38 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: literal substitution
Message-Id: <8qbasm$i7s$1@cheddar.cs.utexas.edu>

In article <8qb49v$eea$1@nnrp1.deja.com>,  <derf_up@yahoo.com> wrote:
>Hi,
>I would like to create a series of arrays, (probably using a for loop
>and $counter++) (i.e. @array1, @array2, @array3, etc…).  I have always
>called this a "literal substitution", but someone else called it
>a "symbolic reference".  In either case in not seeing how to do this in
>any of the O'Reilly books (Camel, Lama, Ram, or Puma).  Maybe it's
>called something else?
>
>for ($counter = 0; $counter <100; $counter++) {
>	@array???$counter???
>}

I think you want to do this:

	for ($counter = 0; $counter < 100; $counter++)
		{
		$symbolic_reference = "array$counter";

		# set the first value to "foo"
		${$symbolic_reference}[0] = "foo";
		}

Basically, what's going on here is that the last line if the for loop
is exactly like typing

		$array0[0] = "foo";

or 

		$array23[0] = "foo";

except that the variable name comes from another variable rather than
from your code.  It's a lot like eval, except that it's restricted to
variable names rather than arbitrary code.  Another way to look at this
is that, rather than using your code to find the data, the perl
interpreter is using another variable's value to just look up the thing
in the symbol table and manipulate it that way.

  - Logan


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

Date: Wed, 20 Sep 2000 21:30:53 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: loop through file - how to loop back one line?
Message-Id: <h0ay5.584$fa2.47299@eagle.america.net>

On Wed, 20 Sep 2000 01:58:59 GMT, Ala Qumsieh <aqumsieh@hyperchip.com> wrote:
>jason <elephant@squirrelgroup.com> writes:
>> the only real problem with saving the previous line is if the lines are 
>> extremely long .. but - as I'm sure you know - this is almost never a 
>> significant problem with a text file
>
>And, you can solve this problem by simply keeping the length of the
>previous line, rather the previous line itself, and seeking back that
>many characters.

And that may be off by some because of the translation of the "\n",
depending on the platform.  I think the suggestion to do the tell()
each time or just save the line is wiser.  

-- 
Garry Williams


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

Date: Wed, 20 Sep 2000 19:55:19 GMT
From: Wonko the Sane <bgy1@is2.nyu.edu>
Subject: Newbie Ques. Text Limits?
Message-Id: <HC8y5.4$lO.12498@typhoon.nyu.edu>

Hi there everyone,

	I was curious if Perl limited the amount of text one can send via
a form.  I have a form that is writing to a text delimited file.  One of
the fields is a essay field, and there are two of them.  The second essay
keeps getting cut off.  Is there a way around this?  Thanks!

Benson Yee
bgy1@is2.nyu.edu


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

Date: Wed, 20 Sep 2000 22:28:16 +0100
From: "Glyndwr" <glynFOOdwr@FSCKdeleteEmeD.co.uk>
Subject: Re: Newbie Ques. Text Limits?
Message-Id: <VX9y5.2147$Rk1.35602@news2-win.server.ntlworld.com>

"Wonko the Sane" <bgy1@is2.nyu.edu> wrote in message
news:HC8y5.4$lO.12498@typhoon.nyu.edu...
> Hi there everyone,
>
> I was curious if Perl limited the amount of text one can send via
> a form.  I have a form that is writing to a text delimited file.  One of
> the fields is a essay field, and there are two of them.  The second essay
> keeps getting cut off.  Is there a way around this?  Thanks!

Assuming that this is a CGI form you're talking about, do both the essay
fields have the same name? If so, change one of them.

--
                                           -=G=-
print join " ",reverse split /\s+/,'hacker. Perl another Just',"\n";
Web: http://www.fscked.co.uk                             ICQ: 66545073




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

Date: Wed, 20 Sep 2000 21:45:35 GMT
From: Wonko the Sane <bgy1@is2.nyu.edu>
Subject: Re: Newbie Ques. Text Limits?
Message-Id: <3eay5.6$lO.16061@typhoon.nyu.edu>

Glyndwr <glynFOOdwr@fsckdeleteemed.co.uk> wrote:
> Assuming that this is a CGI form you're talking about, do both the essay
> fields have the same name? If so, change one of them.

	Thanks for responding.  Yep, it is a CGI form and the two essay
fields do have different names in the HTML.

Benson Yee
bgy1@is2.nyu.edu


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

Date: Wed, 20 Sep 2000 21:48:55 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: Newbie Ques. Text Limits?
Message-Id: <8qbbbv$nhp$1@nnrp1.deja.com>

In article <VX9y5.2147$Rk1.35602@news2-win.server.ntlworld.com>,
  "Glyndwr" <glynFOOdwr@FSCKdeleteEmeD.co.uk> wrote:
> "Wonko the Sane" <bgy1@is2.nyu.edu> wrote in message
> news:HC8y5.4$lO.12498@typhoon.nyu.edu...
> > Hi there everyone,
> >
> > I was curious if Perl limited the amount of text one can send via
> > a form.  I have a form that is writing to a text delimited file.
> > One of the fields is a essay field, and there are two of them.  The
> > second essay keeps getting cut off.  Is there a way around this?
> > Thanks!
>
> Assuming that this is a CGI form you're talking about, do both the
> essay fields have the same name? If so, change one of them.

My first though would have been to ask if he is using GET or POST...
GET definitely is limited to the length of data it will take. The
OP didn't say that the second field was getting cut out, he said it was
getting cut off, which indicates to me that he got what he wanted, just
not all of it.  Sounds like my paycheck...

amonotod

--
    `\|||/                     amonotod@
      (@@)                     netscape.net
  ooO_(_)_Ooo________________________________
  _____|_____|_____|_____|_____|_____|_____|_____|


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 20 Sep 2000 23:03:51 +0100
From: "Glyndwr" <glynFOOdwr@FSCKdeleteEmeD.co.uk>
Subject: Re: Newbie Ques. Text Limits?
Message-Id: <etay5.2236$Rk1.38032@news2-win.server.ntlworld.com>

"Wonko the Sane" <bgy1@is2.nyu.edu> wrote in message
news:3eay5.6$lO.16061@typhoon.nyu.edu...
> Glyndwr <glynFOOdwr@fsckdeleteemed.co.uk> wrote:
> > Assuming that this is a CGI form you're talking about, do both the essay
> > fields have the same name? If so, change one of them.
>
> Thanks for responding.  Yep, it is a CGI form and the two essay
> fields do have different names in the HTML.

Ah well, that's the easy fix out of the way. I can say that if the query
string is getting truncated due to length, it probably won't be Perl to
blame - it'll be the web browser of server. I'd look there for an
explanation.

--
                                           -=G=-
print join " ",reverse split /\s+/,'hacker. Perl another Just',"\n";
Web: http://www.fscked.co.uk                             ICQ: 66545073




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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 4389
**************************************


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