[20028] in Perl-Users-Digest
Perl-Users Digest, Issue: 2223 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 28 00:05:50 2001
Date: Tue, 27 Nov 2001 21:05:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1006923906-v10-i2223@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 27 Nov 2001 Volume: 10 Number: 2223
Today's topics:
Re: comparison failure. <jks@selectacast.net>
Re: comparison failure. <uri@stemsystems.com>
Re: Curses + ANSI? (Chris Fedde)
Re: Do some time calculations... (Chris Fedde)
Re: File::Copy - Which Perl Versions Include It? <jeffp@crusoe.net>
Re: File::Copy - Which Perl Versions Include It? <matt@mattkruse.com>
Re: File::Copy - Which Perl Versions Include It? <jeffp@crusoe.net>
Re: Must be a better way.. <ahamm@programmer.net>
Re: Must be a better way.. <krahnj@acm.org>
Re: Must be a better way.. <uri@stemsystems.com>
Re: Need Source for search engine like google/yahoo (Logan Shaw)
perl memory efficiency (Sam R)
Re: perl memory efficiency (Malcolm Dew-Jones)
regex greediness problem (possible bug?) (Igor Pechtchanski)
Re: regex greediness problem (possible bug?) <jeffp@crusoe.net>
Re: RTFM (was Re: A Perl Bug?) <godzilla@stomp.stomp.tokyo>
Re: Serious Regexp help... <ashley@pcraft.com>
Re: Simple question about the print function <Jon.Ericson@jpl.nasa.gov>
Re: Simple question about the print function <uri@stemsystems.com>
Re: Summing Array Elements <godzilla@stomp.stomp.tokyo>
Re: what's a CHUNK? <jeffp@crusoe.net>
Re: what's a CHUNK? <rsherman@ce.gatech.edu.SPAMBLOCK>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 27 Nov 2001 22:43:20 -0500
From: Joseph Shraibman <jks@selectacast.net>
Subject: Re: comparison failure.
Message-Id: <3C045D58.1040505@selectacast.net>
Uri Guttman wrote:
>>>>>>"JS" == Joseph Shraibman <jks@selectacast.net> writes:
>>>>>>
>
> JS> Here is test.pl:
> JS> #!/usr/bin/perl
>
> no -w there. bad.
>
Yes, after I put it there I caught my typo.
> JS> if ("95" > 90){
>
> don't compare strings to numbers like that.
It was debug code. I was afraid that there might be some problem converting the string to
an int.
>
> JS> "Filesystem 1k-blocks Used Available Use% Mounted on
> JS> /dev/hda1 3958767 3528286 225654 94% /
> JS> /dev/hda5 1981000 1702295 176293 91% /home
> JS> /dev/hda7 6086800 3579554 2191972 62% /local"
> JS> }
>
>
> JS> ( $garbage, @lines) = split /\n/, $temp; #get rid of first entry
> JS> foreach $line (@lines){
> JS> print "line is $line\n";
> JS> $line =~ /\s(\d+)\%\s+(.*)/;
>
> hmm, did this work? check the results of a match before you grab stuff
> from it.
Yes, the regexp worked.
>
> JS> $perc = $1;
> JS> $mount = $2;
> JS> $iperc = int $perc;
>
> why the int call? i don't see any fractions anywhere
see above
>
> JS> print "perc: $perc mount: $mount iperc: $iperc\n";
> JS> perc: '94' mount: / iperc: 94
>
>
> those two lines don't match. i don't see the '' in the print string.
>
> so you must have used different code or output here. please make sure
> they are exactly what you have. i can't debug unknown code.
>
I guess I must have. I took the quotes out at the last minute before posting.
Turned out to be a stupid typo that I kept making again and again in the different test
programs I made to figure out why my comparison wasn't working. Thanks for all the help.
------------------------------
Date: Wed, 28 Nov 2001 04:23:57 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: comparison failure.
Message-Id: <x7bshn8qu9.fsf@home.sysarch.com>
>>>>> "JS" == Joseph Shraibman <jks@selectacast.net> writes:
JS> print "line is $line\n";
JS> $line =~ /\s(\d+)\%\s+(.*)/;
>>
>> hmm, did this work? check the results of a match before you grab stuff
>> from it.
JS> Yes, the regexp worked.
you missed my point. you don't use $1 from a regex UNLESS you know in
the code that the regex matched. if it failed you get the previous value
of $1. always test regexes before you use data from them.
>> why the int call? i don't see any fractions anywhere
JS> see above
what above? you (improperly) grabbed a digit string so how can it have a
fraction?
JS> Turned out to be a stupid typo that I kept making again and again
JS> in the different test programs I made to figure out why my
JS> comparison wasn't working. Thanks for all the help.
well you have several lessons to learn here. always use -w and strict
and always test regexes for failure.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
-- Stem is an Open Source Network Development Toolkit and Application Suite -
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Wed, 28 Nov 2001 04:17:27 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Curses + ANSI?
Message-Id: <rzZM7.582$Fbh.188697600@news.frii.net>
In article <pan.2001.11.27.07.03.19.800309.9312@send.spam>,
xris <dont@send.spam> wrote:
>Not to ask a stupid question, but how might I go about doing that? Are
>there better things than curses for handling multiple scrolling regions
>on the screen, that would also allow for ansi color?
>
Despite my derisive comments earlier, Curses is a pretty good library for
doing this kind of screen management on unixoid operating systems. It has
lots of useful features. I'd not recommend looking much further unless
you want to move to a GUI style interface.
Good Luck
--
This space intentionally left blank
------------------------------
Date: Wed, 28 Nov 2001 04:40:28 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Do some time calculations...
Message-Id: <0VZM7.583$Fbh.188697600@news.frii.net>
In article <9u0qm0$5hs$1@starbuck.cs.utexas.edu>,
Logan Shaw <logan@cs.utexas.edu> wrote:
>In article <pYQM7.155472$QL2.4782888@amsnews03.chello.com>,
> <nobody@nowhere.com> wrote:
>>> "nobody" <nobody@nobody.com> wrote in message
>
>>> print scalar localtime(int(time()/86400)*86400);
>>>
>>> produces;
>>> Tue Nov 27 00:00:00 2001
>
>>It produces:
>>
>>Tue Nov 27 01:00:00 2001
>>
>>on my pc!
>
>On some local Linux and Solaris machines, it produces this:
>
> Mon Nov 26 18:00:00 2001
>
>"print scalar localtime" produces this:
>
> Tue Nov 27 13:47:28 2001
>
>So it's not even the right day...
>
As an exercise for the motivated student compare and contrast the
above with this.
print scalar gmtime(int(time()/86400)*86400);
For extra credit recommend a way of calculating midnight localtime.
--
This space intentionally left blank
------------------------------
Date: Tue, 27 Nov 2001 21:18:09 -0500
From: Jeff 'japhy' Pinyan <jeffp@crusoe.net>
Subject: Re: File::Copy - Which Perl Versions Include It?
Message-Id: <Pine.GSO.4.21.0111272108330.15763-100000@crusoe.crusoe.net>
[posted & mailed]
On Nov 28, Matt Kruse said:
>Can anyone tell me which versions of Perl include File::Copy as part of the
>standard distribution?
>Do all versions back to 5.001 include it?
It was there BEFORE 5.003:
(from Changes5.003)
- Several changes were made to standard library files:
- reduced use of English.pm and $`, $', and $& in library modules,
since these degrade module loading and evaluation of regular
expressions, respectively.
- File/Basename.pm: Added path separator to dirname('.')
- File/Copy.pm: Added support for VMS and OS/2 system-level copy
- MakeMaker updated to v5.26
- Symbol.pm now accepts old (') and new (::) package delimiters
- Sys/Syslog.pm uses Sys::Hostname only when necessary
- chat2.pl picks up necessary constants from socket.ph
- syslog.pl: Corrected thinko 'Socket' --> 'Syslog'
- xsubpp updated to v1.935
So it was PROBABLY there as of Perl 5.001. It was written in 95/96.
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
------------------------------
Date: Wed, 28 Nov 2001 02:25:14 GMT
From: "Matt Kruse" <matt@mattkruse.com>
Subject: Re: File::Copy - Which Perl Versions Include It?
Message-Id: <eWXM7.185979$My2.109760188@news1.mntp1.il.home.com>
"Jeff 'japhy' Pinyan" <jeffp@crusoe.net> wrote:
> It was there BEFORE 5.003:
> So it was PROBABLY there as of Perl 5.001. It was written in 95/96.
Actually, I just found a site which says:
Perl 5.002 Release Notes
...
A number of new standard modules were added, including
File::Copy
Which begs the question... what *is* the correct way to determine which
versions contains which standard modules, and preferrably which versions of
those modules?
When writing portable scripts and the user's environment can vary, it's
dangerous to use 'standard' modules which aren't included in *all* versions
of Perl5, so it would be handy to have a reference.
Matt Kruse
http://www.mattkruse.com/
------------------------------
Date: Tue, 27 Nov 2001 21:35:54 -0500
From: Jeff 'japhy' Pinyan <jeffp@crusoe.net>
Subject: Re: File::Copy - Which Perl Versions Include It?
Message-Id: <Pine.GSO.4.21.0111272134520.15763-100000@crusoe.crusoe.net>
[posted & mailed]
On Nov 28, Matt Kruse said:
>"Jeff 'japhy' Pinyan" <jeffp@crusoe.net> wrote:
>> It was there BEFORE 5.003:
>> So it was PROBABLY there as of Perl 5.001. It was written in 95/96.
>
>Actually, I just found a site which says:
>
> Perl 5.002 Release Notes
> ...
> A number of new standard modules were added, including
> File::Copy
Grr. I could not find such a statement in Changes5.002. That's
upsetting.
>When writing portable scripts and the user's environment can vary, it's
>dangerous to use 'standard' modules which aren't included in *all* versions
>of Perl5, so it would be handy to have a reference.
Well, you COULD always do:
use 5.005;
to require the user have at least 5.005 installed. These days, people
should have at least 5.005.
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
------------------------------
Date: Wed, 28 Nov 2001 13:12:36 +1100
From: "Andrew Hamm" <ahamm@programmer.net>
Subject: Re: Must be a better way..
Message-Id: <3c04485c_1@news.iprimus.com.au>
HoboSong wrote...
>
>Clearly Im a newbie to both Perl and programming, but I havent learned
>a better way to do this... Ive used similar many times without any problems
>but Im trying to be more efficient, can someone just give me a nudge in the
>right direction?
>
That kinda depends on what's happening inside the parse_ functions. Are they
reading more lines from the TEXTFILE? Are they just processing ugly stuff on
the rest of the line?
Any alternatives to your code won't necessarily be more efficient, but just
variations on how to express yourself. It's hard to optimise when you must
find something and then perform an action list this.
Besides that, the I/O time spent reading TEXTFILE will be far more
significant than any speed increases you might squeeze out here, so my
solution is presented on the basis that I/O time will be over-significant
and code clarity is nicer. Try this:
while(<TEXTFILE>) {
chomp; # on a hunch, I've added this for you
parse_settlement($_) if /SETTLEMENT SECTION/;
parse_divs($_) if /DIVIDENDS REPORT/;
parse_risk($_) if /RISK MANAGEMENT REPORT/;
}
I can't even be bothered trying to skip the next tests because of the cost
of reading the file in the first place. I don't think you need your $section
variable, because that's implicitly known since you are entering a specific
code path.
However, if your parse_ functions is modifying $_ or reading more lines,
there may be a chance of false matches on the following lines, then you can
use a structure like this:
while(<TEXTFILE>) {
chomp; # on a hunch, I've added this for you
parse_settlement($_), next if /SETTLEMENT SECTION/;
parse_divs($_), next if /DIVIDENDS REPORT/;
parse_risk($_), next if /RISK MANAGEMENT REPORT/;
}
As usual, there's more than one way to do it in Perl. Which is why that's a
famous Perl slogan.
As you can gather from my reply, the proper answer for you depends on your
data and what you will be doing to it.
--
Space Corps Directive #723
Terraformers are expressly forbidden from recreating Swindon.
-- Red Dwarf
------------------------------
Date: Wed, 28 Nov 2001 04:00:43 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Must be a better way..
Message-Id: <3C04622B.BFD0B40@acm.org>
HoboSong wrote:
>
> Clearly Im a newbie to both Perl and programming, but I havent learned
> a better way to do this... Ive used similar many times without any problems
> but Im trying to be more efficient, can someone just give me a nudge in the
> right direction?
Speed efficiency? Size efficiency? Maintenance efficiency?
> while (<TEXTFILE>) {
>
> if ( /SETTLEMENT SECTION/ ) {
> $section = "settlement";
> } elsif ( /DIVIDENDS REPORT/ ) {
> $section = "divs";
> } elsif ( /RISK MANAGEMENT REPORT/ ) {
> $section = "risk";
> }
>
> if ( $section eq "settlement" ) {
> parse_settlement($_);
> } elsif ($section eq "divs" ) {
> parse_divs($_);
> } elsif ( $section eq "risk" ) {
> parse_risk($_);
> }
> }
my %lookup = ( qr/SETTLEMENT SECTION/, \&parse_settlement,
qr/DIVIDENDS REPORT/, \&parse_divs,
qr/RISK MANAGEMENT REPORT/, \&parse_risk,
);
while ( <TEXTFILE> ) {
for my $regex ( keys %lookup ) {
/$regex/ and $lookup{ $regex }->( $_ );
last;
}
}
John
--
use Perl;
program
fulfillment
------------------------------
Date: Wed, 28 Nov 2001 04:28:29 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Must be a better way..
Message-Id: <x77ksb8qmp.fsf@home.sysarch.com>
>>>>> "JWK" == John W Krahn <krahnj@acm.org> writes:
JWK> my %lookup = ( qr/SETTLEMENT SECTION/, \&parse_settlement,
JWK> qr/DIVIDENDS REPORT/, \&parse_divs,
JWK> qr/RISK MANAGEMENT REPORT/, \&parse_risk,
JWK> );
JWK> while ( <TEXTFILE> ) {
JWK> for my $regex ( keys %lookup ) {
JWK> /$regex/ and $lookup{ $regex }->( $_ );
JWK> last;
hmm, will that ever try the 2nd and third regexes if the first fails?
i think you meant:
$lookup{ $regex }->( $_ ), last if /$regex/ ;
JWK> }
JWK> }
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
-- Stem is an Open Source Network Development Toolkit and Application Suite -
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 27 Nov 2001 20:16:44 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Need Source for search engine like google/yahoo
Message-Id: <9u1hec$bo2$1@starbuck.cs.utexas.edu>
In article <4b5d8d86.0111271635.1ab87890@posting.google.com>,
Pavan <pkkasu@yahoo.com> wrote:
> I am planning to develop a search engine like yahoo/ Google for our
>small community.
Yahoo and Google are very different, actually.
Do you want to have the ability for anyone to search for files only on
your web site? Or do you want something else.
> I am thinking to develop using Perl /PHP/ASP, MY Sql
>& Linux.
Personally, I'd consider using an existing tool. As you might expect,
others have run into this problem before, and there are lots of
solutions that have already been developed.
One popular solution is called webglimpse; see http://webglimpse.org/ .
You might also want to check out http://www.searchtools.com/ .
- Logan
--
"In order to be prepared to hope in what does not deceive,
we must first lose hope in everything that deceives."
Georges Bernanos
------------------------------
Date: 27 Nov 2001 19:51:54 -0800
From: epplor@hotmail.com (Sam R)
Subject: perl memory efficiency
Message-Id: <194298e1.0111271951.7f4aef97@posting.google.com>
I've always known perl was sloppy with memory, but this is ridiculous.
The following program should generate 12.5 million integers for
storage. Depending on your architecture, this may be 4-8 bytes per
int in an ideal situation. However, on solaris 5.8 using perl64
5.6.1, it uses 863 megs!!!
If I use the 32-bit version of perl (5.004) on the same system, it
drops to 560 megs or so (I'm sure due to change in size of pointers
and perhaps default integer size). Even on a linux(32 bit, of course)
box using perl 5.6.1, the usage is 550 megs. Does anyone know how to
get around this? an 8-fold blowup is unacceptible in my real program
(not this simple case) as I aim to have an array of at least 2 million
elements where each element is a 12-element array containing 3 strings
(short) and 9 integers (eventually 100 million of these 12-element
arrays).
anyone know any tricks to get around this? I know if I had only ints
in the
array I could use vec, but that's not the case. This is a general
problem
I have with perl (it's excessively sloppy memory usage--in this case,
using 70 bytes per int).
help?
offending code:
#!/usr/local/bin/perl64 -w
use strict;
my @a;
my $numElem = 50;
my $numArr = 250000;
my $i;
for($i=0; $i <= $numArr; $i++)
{
my $j;
for($j=0; $j < $numElem; $j++)
{
push(@{$a[$i]}, $j);
}
}
print "wait\n";
<>;
------------------------------
Date: 27 Nov 2001 20:34:14 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: perl memory efficiency
Message-Id: <3c046946@news.victoria.tc.ca>
Sam R (epplor@hotmail.com) wrote:
: I've always known perl was sloppy with memory, but this is ridiculous.
: The following program should generate 12.5 million integers for
: storage. Depending on your architecture, this may be 4-8 bytes per
: int in an ideal situation. However, on solaris 5.8 using perl64
: 5.6.1, it uses 863 megs!!!
: If I use the 32-bit version of perl (5.004) on the same system, it
: drops to 560 megs or so (I'm sure due to change in size of pointers
: and perhaps default integer size). Even on a linux(32 bit, of course)
: box using perl 5.6.1, the usage is 550 megs. Does anyone know how to
: get around this? an 8-fold blowup is unacceptible in my real program
: (not this simple case) as I aim to have an array of at least 2 million
: elements where each element is a 12-element array containing 3 strings
: (short) and 9 integers (eventually 100 million of these 12-element
: arrays).
: anyone know any tricks to get around this? I know if I had only ints
: in the
: array I could use vec, but that's not the case. This is a general
: problem
: I have with perl (it's excessively sloppy memory usage--in this case,
: using 70 bytes per int).
That's not 70 bytes per integer - it's 70 bytes per dynamic polymorphic
data structure, all help within a larger dynamic data structure that can
be efficiently manipulated in a variety of useful ways.
70 bytes doesn't sound too bad really.
If you want ints to take 4 bytes then program in C, or get more memory, or
possibly tie the data to something else.
------------------------------
Date: 27 Nov 2001 18:39:11 -0800
From: jaguar_meow@yahoo.com (Igor Pechtchanski)
Subject: regex greediness problem (possible bug?)
Message-Id: <8341781c.0111271839.3eb7d09f@posting.google.com>
Summary: I'm trying to match a regular expression containing
non-printable characters (e.g. "\xFF" or "\x00"). The pattern
contains a greediness modifier (".*?"), but doesn't work if a
non-printable character follows the modifier. If I use a printable
character after the "?", the pattern suddenly works... Has anyone
else encountered this problem, and, if so, does anyone have a
solution?
Detail: I'm using perl v. 5.6.1 on cygwin-nt. I'm trying to match
various image file headers (GIF, JPEG, PNG, etc) and extract the width
and height of the images. I use the following style of regex pattern:
$jpghdr = qr/^\xFF\xD8\xFF\xE0..JFIF\x00.*?\xFF\xC0...(..)(..)/s;
When I include the '?' to modify greediness, the pattern stops
working. If I don't include the '?', the pattern works, but,
obviously, incorrectly, matching the longest possible string. Aside
from the fact that using regular expressions to process chunk-based
files is odd, the problem remains that the greediness modifier stops
working if followed by a non-printable character. Quoting and the
like (\Q..\E, etc) didn't help. ActiveState's perl (v 5.6.0) seems to
exhibit the same behavior. Ideas, anyone?
Igor
------------------------------
Date: Tue, 27 Nov 2001 22:53:35 -0500
From: Jeff 'japhy' Pinyan <jeffp@crusoe.net>
Subject: Re: regex greediness problem (possible bug?)
Message-Id: <Pine.GSO.4.21.0111272246500.15763-100000@crusoe.crusoe.net>
[posted & mailed]
On Nov 27, Igor Pechtchanski said:
>Summary: I'm trying to match a regular expression containing
>non-printable characters (e.g. "\xFF" or "\x00"). The pattern
>contains a greediness modifier (".*?"), but doesn't work if a
>non-printable character follows the modifier. If I use a printable
>character after the "?", the pattern suddenly works... Has anyone
>else encountered this problem, and, if so, does anyone have a
>solution?
This bug was fixed in September (by me :) ). The problem is that there's
a line in the regex source that doesn't allow for a high-bit character
there. This was fix 12031, which has yet to make it out to a released
version of Perl.
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
------------------------------
Date: Tue, 27 Nov 2001 18:13:08 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: RTFM (was Re: A Perl Bug?)
Message-Id: <3C044834.EE6EDD3D@stomp.stomp.tokyo>
Lou Moran wrote:
> Godzilla! wrote:
> >Lou Moran wrote:
> >> Jake Fan wrote:
> >> > Godzilla! wrote:
> SNIP
> >> SNIP
SNIP!
> >Did I not say you boys are trolls? However, this moniker
> >"Lou Moran" is a bit more of a gracious troll than most.
> >I read his post as a classic example of the quality
> >of logic displayed by you boys; a classic example of
> >blowing smoke out of your arse.
> But I'm not Frank, right?
Did I remember to mention the only trolls here
are you boys and, this is self-evident?
Godzilla!
------------------------------
Date: Tue, 27 Nov 2001 20:05:36 -0700
From: "Ashley M. Kirchner" <ashley@pcraft.com>
Subject: Re: Serious Regexp help...
Message-Id: <3C045480.E59B2F99@pcraft.com>
Andrew Hamm wrote:
> Mona's result is the same as our corrected result (if you discount the
> missing field) but just formatted differently. As such, it didn't need any
> corrections ;)
Mona's regexp splits everything as it should, in six fields, right of the bat. The original regexp posted by you only did 5 fields. What has me confused is the greediness you guys were talking about earlier. Did I say regexp isn't exactly my forte? <grin>
--
H | "Life is the art of drawing without an eraser." - John Gardner
+--------------------------------------------------------------------
Ashley M. Kirchner <mailto:ashley@pcraft.com> . 303.442.6410 x130
Director of Internet Operations / SysAdmin . 800.441.3873 x130
Photo Craft Laboratories, Inc. . 3550 Arapahoe Ave, #6
http://www.pcraft.com ..... . . . Boulder, CO 80303, U.S.A.
------------------------------
Date: 27 Nov 2001 17:56:46 +0000
From: Jon Ericson <Jon.Ericson@jpl.nasa.gov>
Subject: Re: Simple question about the print function
Message-Id: <86hergyu5d.fsf@jon_ericson.jpl.nasa.gov>
mfunk@telus.net (Matt Funk) writes:
> I'm attempting to learn perl and I don't understand a simple thing
> about the print function.
>
> If I have a one line program like this:
> print "Hello World!";
> it doesn't work. No errors when I run it with the -w option, it just
> does nothing. But if I also print a newline character it works fine:
> print "Hello World!\n";
>
> Things that make you go hmmmm...if someone could explain what is
> happening that would be great!
It's impossible to know, but I expect that it has something to do with
the environment you are running the program in. For instance, the
next command prompt could be over-writing your output. In any case,
this is not a perl-specific issue.
Jon
--
Two are better than one, because they have a good return for their
work: If one falls down, his friend can help him up. But pity the
man who falls and has no one to help him up! ... Though one may be
overpowered, two can defend themselves. A cord of three strands is
not quickly broken. -- Ecclesiastes 4:9-10,12 (NIV)
------------------------------
Date: Wed, 28 Nov 2001 04:32:21 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Simple question about the print function
Message-Id: <x74rnf8qga.fsf@home.sysarch.com>
>>>>> "MS" == Martin Sanders <msanders76@hotmail.com> writes:
MS> print "Hello, World!";
MS> You can also produce exactly the same output with the following program:
MS> print <<HELLO;
MS> Hello, World!
MS> HELLO
that is not the same output. think carefully about why.
MS> I learnt this trick just today ;-)
good. then i hope you learned that <<FOO (called a here doc) is NOT a
feature of print. too many newbies think that since it is used so often
with print.
and learn to not top post. read these pages:
http://www.btinternet.com/~chiba/sbox/topposters.html
http://www.uwasa.fi/~ts/http/quote.html
http://www.geocities.com/nnqweb/nquote.html
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
-- Stem is an Open Source Network Development Toolkit and Application Suite -
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Tue, 27 Nov 2001 18:06:47 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Summing Array Elements
Message-Id: <3C0446B7.15060A18@stomp.stomp.tokyo>
Uri Guttman wrote:
> Godzilla wrote:
(snipped)
> moronic as usual.
> and the rest of us must compensate for your stupidity.
Oh my gosh! I just realized, you, Martini Furbooger and
Hasselalot b. Parsevars, the three of you are joined at the
brain! Triamese Triplets! Unrecorded medical history!
Three boys all thinking with the same brain!
* one million watt electric arc floodlight goes on over her head *
Say, you Triamese Triplets ever heard of the Ringling Brothers?
Listen, I know this outfit, well, they are not the Ringling
Brothers, nor Barnum and Bailey, but maybe a day will come...
Anywho, I have some friends in the same line of business, just
not as classy or uptown, but boy, hmmm.. * has a thought *
do they have just the spot for you! A very special show which
attracts all kinds of awed spectators...
Hmm.. then again, it could be you three are simply joined
at the hips. With more thought, this seems most likely.
Godzilla!
------------------------------
Date: Tue, 27 Nov 2001 21:07:16 -0500
From: Jeff 'japhy' Pinyan <jeffp@crusoe.net>
Subject: Re: what's a CHUNK?
Message-Id: <Pine.GSO.4.21.0111272106510.15763-100000@crusoe.crusoe.net>
[posted & mailed]
On Nov 27, Sara said:
>Use of uninitialized value at ./procex.pl line 105, <IN> chunk 11.
> main::export_recx ('HASH(0x821d890)') called at ./procex.pl line
That means the 11th block of text read from the filehandle "IN".
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
------------------------------
Date: Wed, 28 Nov 2001 02:18:00 +0000 (UTC)
From: Robert Sherman <rsherman@ce.gatech.edu.SPAMBLOCK>
Subject: Re: what's a CHUNK?
Message-Id: <9u1hgo$bd6$1@news-int.gatech.edu>
In article <776e0325.0111271756.120bc6e2@posting.google.com>, Sara wrote:
> Got this..
>
> Use of uninitialized value at ./procex.pl line 105, <IN> chunk 11.
> main::export_recx ('HASH(0x821d890)') called at ./procex.pl line
>
>
> [tux@tuxy ~]$ perldoc -q chunk
> No documentation for perl FAQ keyword `chunk' found
>
> looked in Camel index under "Chunk", no entry
>
> Use of uninitialized value at ./process_mem.pl line 105, <IN> chunk
> 11.
> main::export_freeuser('HASH(0x821d890)') called at ./process_mem.pl
> line
>
> does chunk 11 mean the 11th hash element if I was to do a keys %hash?
> Since hashes are not ordered I'm uncertain what info this chunk
> thingie tells me!
>
> Thanks,
> GX
a quick search of groups.google.com will turn up the following thread:
Documentation: What is a chunk - exactly?
go check it out...
--
robert sherman
css3, school of civil and environmental engineering
georgia institute of technology
atlanta, ga, usa
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.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 V10 Issue 2223
***************************************