[17247] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4669 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 19 21:10:28 2000

Date: Thu, 19 Oct 2000 18:10:16 -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: <972004216-v9-i4669@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 19 Oct 2000     Volume: 9 Number: 4669

Today's topics:
    Re: How to find out the number of lines in a flat file. <anders@wall.alweb.dk>
    Re: How to find out the number of lines in a flat file. (Martien Verbruggen)
    Re: How to find out the number of lines in a flat file. <jeffp@crusoe.net>
    Re: http referer manipulation <me@privacy.net>
    Re: http referer manipulation <me@privacy.net>
    Re: manipulating data files <godzilla@stomp.stomp.tokyo>
    Re: manipulating data files <ren.maddox@tivoli.com>
        re: Perl & mySql <james@NOSPAM.demon.co.uk>
        re: Perl & mySql <mrobison@c802.crane.navy.mil>
    Re: Perl <=> C++ ? (Martien Verbruggen)
        pseudo-parallel command execution inphektid@my-deja.com
    Re: pseudo-parallel command execution <uri@sysarch.com>
    Re: reading/writing binary data <ianb@ot.com.au>
    Re: Regex and end of line wierdness <ianb@ot.com.au>
    Re: Seeking the DATA handle. (Martien Verbruggen)
    Re: spawning (system, exec and `prog`) calls <anders@wall.alweb.dk>
        Strange memory reading under Win32 (Andrew J. Perrin)
    Re: Using a command line variable <juex@deja.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 20 Oct 2000 00:31:46 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: How to find out the number of lines in a flat file.....
Message-Id: <4EKH5.6934$Uy5.249386@news000.worldonline.dk>

Slim wrote:

> Hello,
> I'm trying to make a image gallery script and I'm using many flat file
> databases..... they all may have more or less lines and I want to know
> how to get the number of lines there are.....

# you shoud put the filename in $file
# read file
open AFILE, $file or die "Couldn't open $file: $!\n";
my @file = <FILE>;
close FILE or die "bad luck attempting to close $file: $!\n";

# save the number of lines
my $howmanylines = scalar @file;

> 
> also I've been trying to print out a table of them three cols by what
> ever many rows to how many it needs to finish adding the images.......

Eeeh?

If you want a HTML table with tree cols, one picture in each col, just go 
ahead. Assuming the lines in $file holds something like

imagename       description     photographer    price

seperated by \t (tabs), do

my $count;
my $count = 0;
print '<table>';
for (@file) {
    print '<tr>' unless $count%3; #new row if no modulus
    my ($image, $desc, $phot, $price) = split (/\t+/);
    print qq(<td>...</td>); # however you wish to format,
                            # using the vars from the split
    print '</tr>' unless $count%3; #new row if no modulus
    $count++;
}
print '</table>';

> to get the images I split the database up and get $thumb[0] is the
> first image....... and there are a different number of thumbs in each
> of the databases, could be 10, 20, etc.........

Depending on the size of the file, you may wish to take a look at the DBI + 
DBD::CSV modules.


Did this help?

-anders

-- 
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]


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

Date: Fri, 20 Oct 2000 10:32:28 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: How to find out the number of lines in a flat file.....
Message-Id: <slrn8uv14c.fji.mgjv@martien.heliotrope.home>

On Fri, 20 Oct 2000 00:31:46 +0200,
	Anders Lund <anders@wall.alweb.dk> wrote:
> Slim wrote:
> 
> > Hello,
> > I'm trying to make a image gallery script and I'm using many flat file
> > databases..... they all may have more or less lines and I want to know
> > how to get the number of lines there are.....
> 
> # you shoud put the filename in $file
> # read file
> open AFILE, $file or die "Couldn't open $file: $!\n";
> my @file = <FILE>;
> close FILE or die "bad luck attempting to close $file: $!\n";
> 
> # save the number of lines
> my $howmanylines = scalar @file;

This solution works. Of course, you will need enough memory to store the
whole file. If the files get large, maybe the following is more
efficient:

my $numlines = 0;
open(AFILE, $file) or die "Couldn't open $file: $!";
$numlines++ while <AFILE>;
close AFILE;

otherwise, something slightly less verbose might be:

open(AFILE, $file) or die "Couldn't open $file: $!";
my $numlines = () = <AFILE>;
close AFILE;

although I think this still reads in the whole file into a temporary
list in memory. It is however possible that Perl optimises the memory
use away. Maybe one of the people who knows the internals could
clarify this?

Martien
-- 
Martien Verbruggen              | Since light travels faster than
Interactive Media Division      | sound, isn't that why some people
Commercial Dynamics Pty. Ltd.   | appear bright until you hear them
NSW, Australia                  | speak?


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

Date: Thu, 19 Oct 2000 20:55:39 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: How to find out the number of lines in a flat file.....
Message-Id: <Pine.GSO.4.21.0010192053250.25707-100000@crusoe.crusoe.net>

[posted & mailed]

On Oct 20, Martien Verbruggen said:

>my $numlines = 0;
>open(AFILE, $file) or die "Couldn't open $file: $!";
>$numlines++ while <AFILE>;
>close AFILE;

You could always use the $. variable:

  open AFILE, $file or die "can't read $file: $!";
  1 while scalar <AFILE>;  # doesn't even save to $_
  $count = $.;  # must be done before you close the FH
  close AFILE;

>open(AFILE, $file) or die "Couldn't open $file: $!";
>my $numlines = () = <AFILE>;
>close AFILE;
>
>although I think this still reads in the whole file into a temporary
>list in memory. It is however possible that Perl optimises the memory
>use away. Maybe one of the people who knows the internals could
>clarify this?

It does build a list, and store it into the empty list.  It's less
efficient.  Even though it doesn't save the lines to memory, it still has
to build the list.

-- 
Jeff "japhy" Pinyan     japhy@pobox.com     http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/
CPAN - #1 Perl Resource  (my id:  PINYAN)        http://search.cpan.org/





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

Date: Thu, 19 Oct 2000 22:13:48 GMT
From: "EM" <me@privacy.net>
Subject: Re: http referer manipulation
Message-Id: <wmKH5.7103$44.21455@news.iol.ie>

Whats the code to do that?


"Tina Mueller" <tina@streetmail.com> wrote in message
news:8snqbe$kujje$3@ID-24002.news.cis.dfn.de...
> hi,
> In comp.lang.perl.misc EM <me@privacy.net> wrote:
> > I use this code to redirect the browser to an url
>
> > print "Content-type: text/html\n";
> > print "Location: $url\n\n";
>
> > this works fine but i want a way to do this but not to send any http
referer
> > to the target url
> > if possible also is there a way to send a fake http referer?
>
> write your own browser:
> perldoc lwpcook
>
> means, insteat of redirecting to the url, call
> the url with lwp (with your own referer), then
> print out the result of the url.
>
> tina
>
> --
> http://tinita.de    \  enter__| |__the___ _ _ ___
> tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
> search & add comments \    \__,_\___/\___/_| /__/ perception
> please don't email unless offtopic or followup is set. thanx




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

Date: Thu, 19 Oct 2000 22:15:30 GMT
From: "EM" <me@privacy.net>
Subject: Re: http referer manipulation
Message-Id: <6oKH5.7104$44.21475@news.iol.ie>

Sorry
to be specific
i know the code to retrieve a page with LWP
but how do i set what i want the referer to be?
Please give me an example code



"Tina Mueller" <tina@streetmail.com> wrote in message
news:8snqbe$kujje$3@ID-24002.news.cis.dfn.de...
> hi,
> In comp.lang.perl.misc EM <me@privacy.net> wrote:
> > I use this code to redirect the browser to an url
>
> > print "Content-type: text/html\n";
> > print "Location: $url\n\n";
>
> > this works fine but i want a way to do this but not to send any http
referer
> > to the target url
> > if possible also is there a way to send a fake http referer?
>
> write your own browser:
> perldoc lwpcook
>
> means, insteat of redirecting to the url, call
> the url with lwp (with your own referer), then
> print out the result of the url.
>
> tina
>
> --
> http://tinita.de    \  enter__| |__the___ _ _ ___
> tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
> search & add comments \    \__,_\___/\___/_| /__/ perception
> please don't email unless offtopic or followup is set. thanx




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

Date: Thu, 19 Oct 2000 15:11:56 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: manipulating data files
Message-Id: <39EF71AC.822CAF6B@stomp.stomp.tokyo>

Randy Harris wrote:
 
> Godzilla! quipped:
> > Randy Harris wrote:
> > > Godzilla! wrote clean efficient code:
> > > > triggerfish2001 aka Rick Delaney aka Randy Harris wrote:

(snipped)


> OK.  I admit I'm a bit slow.  It has taken me a while to realize, you
> really are a nut.  It has become apparent that attempting to communicate
> with you is a waste of time and newsgroup message space.  A foolish
> mistake which I won't repeat.


Yes, you are a bit slow and, I doubt you
have enough spunk to be randy.

Godzilla!


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

Date: 19 Oct 2000 15:59:26 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: manipulating data files
Message-Id: <m3d7gwfsy9.fsf@dhcp11-177.support.tivoli.com>

Larry Rosler <lr@hpl.hp.com> writes:

> In article <m3n1g0hgpa.fsf@dhcp11-177.support.tivoli.com> on 19 Oct 2000 
> 
> 12:41:05 -0500, Ren Maddox <ren.maddox@tivoli.com> says...
> + triggerfish2001@hotmail.com writes:
> + 
> + > source file will be as follows:
> + > 
> + > John Smith           745-678-089011-10-1955
> + > Robert IhaveAlongName345-567-453219-04-1967
> + > 
> + > Here the first 22 char is fixed length for name
> + > Starting from 23rd char next 12 char is for SSN
> + > Starting from 35th char next 10 char is for DOB.
> + > 
> + > Now this needs to be changed to
> + > John Smith|745-678-0890|11-10-1955|
> + > Robert IhaveAlongName|345-567-4532|19-04-1967|
> + 
[snip]
> + perl -pe 'foreach $field (21, 34, 45) { substr $_, $field, 0, "|" }'
> 
> 1.  That doesn't handle the first example, which requires stripping the 
> trailing spaces from the first field.

It's amazing the things that your brain can simply filter out.  I
never even noticed that the spaces were to be stripped.  Doh!

> 2.  To avoid brain warp, it might be better to do those substitutions 
> right-to-left, so columns can be counted from the original, not the 
> successive copies:
> 
>                            (43, 33, 21)

You aren't kidding about the brain warp... I was certainly confused
when I was testing it, but I just thought I was being mathematically
obtuse.  Proceeding backwards as you suggest is *so* much
cleaner... thanks!

-- 
Ren Maddox
ren@tivoli.com


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

Date: Thu, 19 Oct 2000 23:56:10 +0100
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: re: Perl & mySql
Message-Id: <ant192210354fNdQ@oakseed.demon.co.uk>

In article <8snpve$nn9$1@nnrp1.deja.com>, Miker
<URL:mailto:mrobison@c802.crane.navy.mil> wrote:
> 
> i do NOT recommend the o'reilly "mysql and msql" book
> for learning.  maybe a reference.

I'm surprised that you think that. I found it quite understandable
although I must admit to reading it in parallel with the O'Reilly book
"Programming the Perl DBI" which covered the DBI to a much greater
depth than "MySQL & mSQL" did. I guess the best advice would be to
recommend the DBI book for learning and the MySQL book for reference.

> maybe dubois' mysql or the sams club teach yourself mysql in 21 days.

Unless the original poster needs to administer MySQL they could just use
the DBI book to learn from and the documentation on the MySQL web site:

http://www.mysql.com/documentation/

for reference purposes.

-- 
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02



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

Date: Fri, 20 Oct 2000 00:17:27 GMT
From: Miker <mrobison@c802.crane.navy.mil>
Subject: re: Perl & mySql
Message-Id: <8so2ui$v7u$1@nnrp1.deja.com>


> > i do NOT recommend the o'reilly "mysql and msql" book
> > for learning.  maybe a reference.
>
> I'm surprised that you think that. I found it quite understandable
> although I must admit to reading it in parallel with the O'Reilly book
> "Programming the Perl DBI" which covered the DBI to a much greater
> depth than "MySQL & mSQL" did

well, here's a particular example.  i was flat-out trying
to learn it from the ground up.  i was using mysql so i
skipped the msql chapters.  well, things are going great
until they put the part about needing to create the data-
base in the msql part and skip it in the mysql part... so
next thing i know i'm trying to create tables in the mysql
database.  it wasn't pretty.

its a typical scenario though when you try to learn from
almost any reference.  a reference implies that you already
have an inkling of what you need to do, but merely need to
fill in the details.

miker





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


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

Date: Fri, 20 Oct 2000 10:16:26 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Perl <=> C++ ?
Message-Id: <slrn8uv06a.fji.mgjv@martien.heliotrope.home>

On Thu, 19 Oct 2000 20:26:34 +0200,
	ANDERS FLODERUS <anders.floderus@swipnet.se> wrote:
> I have a C++ class whos behaviour is directed
> throu a Command method,
> int myClass::Command( char* pCommamd );
> I would like to use Perl to construct Command strings
> and, depending on the return value, send a new command.
> 
> Is this possible ?
> 
> Either to build a task that somehow includes both Perl
> and myClass.
> Or to build a task that somehow communictes with a
> Perl script.

There are many ways to do this. You could have two processes that talk
via TCP/IP or maybe some other means (pipes). Or you could write a perl
program that forks a C++ program, and they communicate over
STDOUT/STDIN.

# perldoc perlipc
# perldoc perlopentut

Or you could write a C++ program that embeds a perl interpreter

# perldoc perlembed

Or you could write a XS frontend for your C++ classes and write a
program in Perl that uses them:

# perldoc perlxs
# perldoc perlxstut

> I am working with Visual C++ on Windows NT.

That limits your IPC possibilities, but it still is possible.

I think that writing two separate programs, and making them communicate
is probably easiest. XS is probably the hardest, especially with C++.

I think the first thing I would try is to write a simple C++ program
that is a wrapper around your class. Then write a perl program that
forks (yes, fork is supported on perl for NT nowadays) your wrapper
program, and talks to it via stdin/stdout. perlipc and perlopentut have
examples on this.

It all depends on how fast, flexible, robust, portable, and other things
you want all this to be.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | life ain't fair, but the root
Commercial Dynamics Pty. Ltd.   | password helps. -- BOFH
NSW, Australia                  | 


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

Date: Thu, 19 Oct 2000 22:07:32 GMT
From: inphektid@my-deja.com
Subject: pseudo-parallel command execution
Message-Id: <8snrav$orh$1@nnrp1.deja.com>

i'm currently working on a project that is
concerned with starting up multiple cellular
phone switch sites... the problem is, starting up
each site is quite a lengthy process and i am
trying to figure out a way to use Perl to start
them all up at once (pseudo-parallel) rather than
having to wait for the first start-up to complete
before executing the next start-up process
(linearly; in turn)...

here's an abstract run down of the current
problem:

sub start_switch
{
 # ...do some data manipulation

 if ($name eq $ALL)
  {
   foreach $switch(@switches){start_switch
($switch);}
  }
 else
  {
  # ...do some more manipulation

  system($start_command);
 }
}

i'm wondering if there is anyway to start
multiple commands without having to wait for them
to return before starting the next... right now
i'm investigating some way to do this using FORK
and EXEC rather than SYSTEM, but i'm quite unsure
as to if i'm headed down the right path.

any sort of help would be GREATLY appreciated...

thanks


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


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

Date: Thu, 19 Oct 2000 22:40:47 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: pseudo-parallel command execution
Message-Id: <x7itqoqwsw.fsf@home.sysarch.com>

>>>>> "i" == inphektid  <inphektid@my-deja.com> writes:


  i> i'm wondering if there is anyway to start
  i> multiple commands without having to wait for them
  i> to return before starting the next... right now
  i> i'm investigating some way to do this using FORK
  i> and EXEC rather than SYSTEM, but i'm quite unsure
  i> as to if i'm headed down the right path.

fork/exec will work but you need to know what you are doing. look into
open with pipes, or even open |- or -| which does an fork/pipe for
you. then you can exec in the children and control them with IO::Select
or Event.pm

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Fri, 20 Oct 2000 10:42:16 +1100
From: Ian Boreham <ianb@ot.com.au>
Subject: Re: reading/writing binary data
Message-Id: <39EF86D8.3C8C9023@ot.com.au>

Uri Guttman wrote:

> >>>>> "RLS" == Randal L Schwartz <merlyn@stonehenge.com> writes:
>
> >>>>> "Tom" == Tom Briles <sariq@texas.net> writes:
>   Tom> Randal once said that he was going to write an article on pack() and
>   Tom> unpack() for one of his columns.
>
>   Tom> I don't see it on his website, though.
>
>   RLS> It's still in my "idea" list.  I have to come up with a clever
>   RLS> thing to do with it before I write about it. :)
>
> but there is no idea on earth that will use all or even many of pack's
> formats. so that wouldn't make a good tute in any case. mjd's request is
> good. we need a packtoot perldoc.

This is of great interest to me. I spent some time using pack() and unpack() a
while ago, and found that although they have a lot of features, they don't
(didn't?) do several things I would like to do.

I have since (partially) written a package which I am currently tidying up for
public perusal, which is a kind of mega-unpack (and in future hopefully also
will cover pack()).

The specific features I wanted were the abilities to:

 . register my own types / new names for existing types

 . return structured data rather than just a list (LOL, hashes etc)

 . allow processing before returning the data (for example, passing a subset of
the data to an object constructor, reversing)

 . allow back-referencing (for example, if the binary data contains a count
followed by an array of data items of that size, to be able to express that
within the pattern string)

The main goal from my point of view is to be able to exress the structure of
most binary data (files), or at least large chunks of them, in a single, clear
pattern, allowing faster comprehension, implementation and maintenance
(although sacrificing speed - currently it's all in perl, and uses unpack and
some string copying under the covers).

This mail is a little premature. My perl versions are a little old, so I have
to catch up with the latest unpack(). The module's not on CPAN yet, and I'm
still making it "nice", but if people are interested, I can post some info
about it here. My original intention was to post to the modules group or the
module mail archive list.

I am making a few examples (e.g. parsing a BMP file), but I would like some
input from anyone who might have other particular features that it doesn't
support. I would also like to know if there is also anything that already does
this (I haven't found anything on CPAN, but it's not always easy).

I'll try to post something in the next few days.

Regards,


Ian




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

Date: Fri, 20 Oct 2000 11:04:53 +1100
From: Ian Boreham <ianb@ot.com.au>
Subject: Re: Regex and end of line wierdness
Message-Id: <39EF8C25.EACF36B3@ot.com.au>

Martien Verbruggen wrote:

> But be aware that you are throwing out perfectly valid IP addresses.

Mastering Regular Expressions, by Jeffrey Friedl discusses the issue of
matching IP addresses.

Don't forget that, for example 0.0.0.0 is not valid, and you may need to be
more precise than simply "is it valid" - you  may want to restrict it to
particular subnets or something.

Regards,


Ian




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

Date: Fri, 20 Oct 2000 10:20:49 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Seeking the DATA handle.
Message-Id: <slrn8uv0eh.fji.mgjv@martien.heliotrope.home>

On Thu, 19 Oct 2000 22:58:42 +0200,
	Adam <adamf@box43.gnet.pl> wrote:
> Can anyone tell if there is a method to reset the standard DATA handle.
> As I expected seek(DATA, 0, 0) does not work.

Record the position before using it for the first time.

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

my $data_pos = tell DATA;
my @lines = <DATA>;
print @lines;
seek DATA, $data_pos, 0;
my @lines2 = <DATA>;
print @lines2;

__DATA__
line 1
line 2

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | You can't have everything, where
Commercial Dynamics Pty. Ltd.   | would you put it?
NSW, Australia                  | 


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

Date: Fri, 20 Oct 2000 00:47:48 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: spawning (system, exec and `prog`) calls
Message-Id: <6TKH5.6943$Uy5.250177@news000.worldonline.dk>

P&C wrote:

> I'm using Activestate perl build 616 on W2K Adv Server.
> 
> I have a child process called dbimport which takes a string as a
> parameter as in:
> 
> dbimport userid,password,Firstname Lastname,stuff,stuff,TRUE
> 
> This works fine from the command line or from a .cmd file.  However
> from within my perl script this process does not appear to ever get
> executed.  I've tried:
> 
> `dbimport \"userid,password,Firstname Lastname,stuff,stuff,TRUE\"`;

did you try without the backslashes?

$result = `dbimport " userid,password,Firstname \
Lastname,stuff,stuff,TRUE"`;

and would you put the quots ``"'' there on the command line?

> 
> and
> 
> system "dbimport \"userid,password,Firstname
> Lastname,stuff,stuff,TRUE\"`;
> 
> printing $! after this system call shows nothing.

It probably executes, but you don't get executed without problems, see 
below. First, here's a snip from the perl faq:


       Why can't I get the output of a command with system()?
 
       You're confusing the purpose of system() and backticks
       (``).  system() runs a command and returns exit status
       information (as a 16 bit value: the low 7 bits are the
       signal the process died from, if any, and the high 8 bits
       are the actual exit value).  Backticks (``) run a command
       and return what it sent to STDOUT.
 
           $exit_status   = system("mail-users");
           $output_string = `ls`; 

------------------
 
> How can I track what's wrong or determine how/why this is failing?

Here's a bit from perldoc -f system:

                   @args = ("command", "arg1", "arg2");
                   system(@args) == 0
                        or die "system @args failed: $?"
 
               You can check all the failure possibilities by
               inspecting `$?' like this:
 
                   $exit_value  = $? >> 8;
                   $signal_num  = $? & 127;
                   $dumped_core = $? & 128; 

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

and of cause, use strict, use warnings;-))



-anders
-- 
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]


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

Date: 19 Oct 2000 20:14:44 -0400
From: aperrin@demog.berkeley.edu (Andrew J. Perrin)
Subject: Strange memory reading under Win32
Message-Id: <u3dhscqrv.fsf@demog.berkeley.edu>

Greetings. Running a script with a very large array (see my previous
post) under NT4 (activeperl 5.6.0), I've noticed an odd
behavior. Typically I keep three windows open: a cygwin-bash window
from which the script was started, another with a tail -f to watch the
output, and the Windows NT Task Manager to watch memory consumption.

What I've noted is that when I minimize the window from which the perl
script was started, perl.exe drops to 0 bytes of RAM used in the task
manager, then slowly climbs back up (in this case, to about 60
megabytes). This is reproducible - maximizing and minimizing it again
does the same thing.

Questions:
- Is this normal? Why?
- What are the implications for the script's efficiency if it has to
recopy itself into memory?

Thanks.

-- 
----------------------------------------------------------------------
Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology  
Chapel Hill, North Carolina, USA - http://demog.berkeley.edu/~aperrin
        aperrin@socrates.berkeley.edu - aperrin@igc.apc.org


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

Date: Thu, 19 Oct 2000 17:27:05 -0700
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: Using a command line variable
Message-Id: <39ef9158$1@news.microsoft.com>

"JStanton" <stanton@spec.com> wrote in message
news:3C1003FCBC2A786E.7688D3EF811A1FA1.A1DA16F53D5AEC69@lp.airnews.net...
> I've looked for some info on a seemingly simple command, but no luck.
> How can I take a command line variable and use it as a variable in
> Perl?

Not sure what you mean with a command line variable.
- Are you talking about the environment variables in a command shell? They
can be found in %ENV.
- Or are you talking about command line arguments to a Perl script? They can
be found in @ARGV.

jue




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

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


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