[11899] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5499 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 27 18:07:04 1999

Date: Tue, 27 Apr 99 15:00:19 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 27 Apr 1999     Volume: 8 Number: 5499

Today's topics:
    Re: can not find the simple.pm homelessinseattle@my-dejanews.com
    Re: DBD/ODBC for Informix Win32 with Cygwin <gellyfish@gellyfish.com>
        E-Mail from NT Via Net::SMTP <kstephan@my-dejanews.com>
    Re: FAQ 4.68: How do I handle binary data correctly? (Brand Hilton)
    Re: FAQ not applicable (was: Eliminate elements from ar <aqumsieh@matrox.com>
    Re: How can I make an auto-url with a search and replac scraig@my-dejanews.com
    Re: how to read a huge file line by line without loadin <gellyfish@gellyfish.com>
        Keeping order in a hash raanders@acc.jc.edu
    Re: Keeping order in a hash (Larry Rosler)
    Re: list of list <gellyfish@gellyfish.com>
    Re: list of list scraig@my-dejanews.com
    Re: newbie: Replace \n with <br>\n <sarmad@fas.harvard.edu>
    Re: newbie: Replace \n with <br>\n (Larry Rosler)
    Re: On the fly conversion <gellyfish@gellyfish.com>
    Re: Output from eval homelessinseattle@my-dejanews.com
    Re: problem with single quotes or abuse by programmer <gellyfish@gellyfish.com>
    Re: problem with single quotes or abuse by programmer (Larry Rosler)
    Re: question from a newbie <homelessinseattle@my-dejanews.com>
    Re: ROUNDING A NUMBER IN PERL <gregm@well.com>
    Re: ROUNDING A NUMBER IN PERL (Larry Rosler)
        Server Overload <webdude@mcminn.net>
        sorting Label values in popup_menu <sushant@ntwrks.com>
    Re: Text Counter <cassell@mail.cor.epa.gov>
    Re: Where find a2p? <cassell@mail.cor.epa.gov>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Tue, 27 Apr 1999 20:46:20 GMT
From: homelessinseattle@my-dejanews.com
Subject: Re: can not find the simple.pm
Message-Id: <7g57mq$fge$1@nnrp1.dejanews.com>

In article <7g50q4$8q5$1@nnrp1.dejanews.com>,
  wendy1967@my-dejanews.com wrote:
> Hello,

> <H1>Software error:</H1> <CODE>[Tue Apr 27 14:34:02 1999] Simple.pm: Can't
> locate LWP/Simple.pm in @INC ( @INC contains:
> /usr/local/lib/perl5/5.00556/sun4-solaris /usr/local/lib/perl5/5. 00556

                           It kinda lookslike there's a space here ^
That could be a problem.

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


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

Date: 27 Apr 1999 21:12:35 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: DBD/ODBC for Informix Win32 with Cygwin
Message-Id: <7g5983$dp$1@gellyfish.btinternet.com>

On 27 Apr 1999 13:26:36 GMT Joonas Timo Taavetti Kekoni wrote:
> Can I compile and get DBD/ODBC to work with Informix in Win32 (NT)
> platform by compiling it with cygwin? Has anyone done that?
> 

Have you compiled your own perl with Cygwin ?  If you have ActivePerl
then you will be able to use either of Win32::ODBC or DBD::ODBC which
install easily with PPM - I have used both with Informix and they work fine.

> I am not intrested in DBD/Informix since it requires extra priced
> componets from Informix ( and i can always system() the command
> line tools, despite it is ugly.)
> 

Actually no.  The Informix client SDK can now be downloaded free for a
variety of platforms including Win32 - however I think to build DBD::Informix
with this you will need the MS C compiler - I have tried to use the ESQL
preprocessor with gcc but it cant get it to work.

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


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

Date: Tue, 27 Apr 1999 20:51:48 GMT
From: kstephan <kstephan@my-dejanews.com>
Subject: E-Mail from NT Via Net::SMTP
Message-Id: <7g5813$fs7$1@nnrp1.dejanews.com>

I installed Net::SMTP via "ppm install libnet", per Yong Huang, and when I
execute the script found with ActivePERL, i.e,

  use Net::SMTP;  $smtp = Net::SMTP->new('smtp.xxx.com'); # connect to an
SMTP server  $smtp->mail( 'kstephan\@xxxx.xxx.com' );  # use the sender's
address here  $smtp->mail( 'kstephan\@csc.com' );  # use the sender's address
here

        $smtp->to('kstephan\@xxxx.xxx.com');        # recipient's address

        $smtp->data();                      # Start the mail

        # Send the header.
        #
        $smtp->datasend("To: kstephan\@xxxx.xxx.com\n");
        $smtp->datasend("From: kstephan\@xxxx.xxx.com\n");
        $smtp->datasend("\n");

        # Send the body.
        #
        $smtp->datasend("Hello, World!\n");

        $smtp->dataend();                   # Finish sending the mail
        $smtp->quit;                        # Close the SMTP connection

A script containing this code runs, then exits without error, but I still
do not receive any mail.

Could the answers that I gave when I installed Net::SMTP be part of the
problem??

Thanks for any guidance!!

New To PERL Ken

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


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

Date: 27 Apr 1999 21:39:57 GMT
From: bhilton@tsg.adc.com (Brand Hilton)
Subject: Re: FAQ 4.68: How do I handle binary data correctly?
Message-Id: <7g5ard$1bj1@mercury.adc.com>

In article <37262cff@cs.colorado.edu>,
Tom Christiansen  <perlfaq-suggestions@perl.com> wrote:
>    the perlfunc manpage, or the upcoming the perlopentut manpage
>    manpage.                 ^^^          ^^^             ^^^^^^^
     ^^^^^^^

Double double words words.

-- 
 _____ 
|///  |   Brand Hilton  bhilton@adc.com
|  ADC|   ADC Telecommunications
|_____|   Richardson, Texas


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

Date: Tue, 27 Apr 1999 16:11:59 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: FAQ not applicable (was: Eliminate elements from array with second array?)
Message-Id: <x3yr9p5hlgw.fsf@tigre.matrox.com>


lou@visca.com writes:

> My thanks to all who answered, but as Andrew Allen points out, the
> FAQ isn't applicable in my case. 

Then you probably misunderstood your own question :-)



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

Date: Tue, 27 Apr 1999 21:00:17 GMT
From: scraig@my-dejanews.com
Subject: Re: How can I make an auto-url with a search and replace?
Message-Id: <7g58gv$gca$1@nnrp1.dejanews.com>

In article <7g4mpo$6hl$1@dinkel.civ.utwente.nl>,
  "Albert Brand" <rtficial@dds.nl> wrote:
> Let's take this string:
>
> "Go to http://come.to/inf-inity "
>
> And i would like to have it converted to:
>
> "Go to <a href="http://come.to/inf-inity">come.to/inf-inity</a> "

$string =~ s#(http://)(\S*)#<a href="$1$2">$2</a>#;



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


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

Date: 27 Apr 1999 21:22:36 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: how to read a huge file line by line without loading it into memory
Message-Id: <7g59qs$e0$1@gellyfish.btinternet.com>

On Tue, 27 Apr 1999 17:10:24 GMT jeposner@my-dejanews.com wrote:
> I have two very large files (each greater than the amount of memory on my
> box) -	I need to perform a two file match, but the only way I know in perl
> is to load the files up into memory with Open.
> 
> How can I read from each file one line at a time, or even better a block of N
> lines at a time?
> 

Sorry, something other than reading the file a line at a time like:

while (<FILEHANDLE> )
  {
    # Blah
  }

Or am I misunderstanding something here ?

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


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

Date: Tue, 27 Apr 1999 20:58:49 GMT
From: raanders@acc.jc.edu
Subject: Keeping order in a hash
Message-Id: <7g58ea$g3d$1@nnrp1.dejanews.com>

I am reading a file and creating a hash from the data read from that file. 
The problem is that when the data is read in, instead of keeping the order
that the file is in, the hash is put in alphabetical order.  My code is this:

while (<FILE>){
		if (/^FAM: (.*)/) {
			$family = $1;
		}
                if (/^PIC: (.*)/) {
			@bflypics = split / /, $1;
			foreach $picture (@bflypics) {
				$picturegroups{$family}{$picture} = $common;
                }
}

I need to have the %picturegroups hash sorted by $family but not in
alphabetical order, which it is automatically put in.  The file from which
the data is read is already in the correct order but when put into the hash,
it is put in alphabetically.  Is there a simple fix for this?  Any help would
be greatly apprectiated!  Thanks in advance!

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


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

Date: Tue, 27 Apr 1999 14:59:28 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Keeping order in a hash
Message-Id: <MPG.118fd31ae09ae18498995a@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7g58ea$g3d$1@nnrp1.dejanews.com> on Tue, 27 Apr 1999 
20:58:49 GMT, raanders@acc.jc.edu <raanders@acc.jc.edu> says...
> I am reading a file and creating a hash from the data read from that file. 
> The problem is that when the data is read in, instead of keeping the order
> that the file is in, the hash is put in alphabetical order.

What makes you think that?  Hashes are inherently unordered.

> My code is this:
> 
> while (<FILE>){
> 		if (/^FAM: (.*)/) {
> 			$family = $1;
> 		}
>                 if (/^PIC: (.*)/) {
> 			@bflypics = split / /, $1;
> 			foreach $picture (@bflypics) {
> 				$picturegroups{$family}{$picture} = $common;
>                 }
> }
> 
> I need to have the %picturegroups hash sorted by $family but not in
> alphabetical order, which it is automatically put in.  The file from which
> the data is read is already in the correct order but when put into the hash,
> it is put in alphabetically.

You must be a fan of Lewis Carroll.  From 'The Hunting of the Snark':  

     What I tell you three times is true. 

No matter how many times you say this, it isn't so!

> Is there a simple fix for this?  Any help would
> be greatly apprectiated!  Thanks in advance!

RTFFAQ.  perlfaq4:  "How can I always keep my hash sorted?"

If the data from the file are already in the order you want, you might 
use an array.  Or you can sort on the keys of your hash.

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


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

Date: 27 Apr 1999 20:54:07 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: list of list
Message-Id: <7g585f$dk$1@gellyfish.btinternet.com>

On Tue, 27 Apr 1999 09:30:50 GMT Sheila  Eugenio wrote:
> let's say the actual returned values are (I have omitted 4 other cols):
> DAY 	INS		BOH   		
> 1	34668		637299	
> 2       	67290		620574
> 1	97331		575218
> 2	102327	564416
> my $row_ref = $sth->fetchall_arrayref;
> $sth->finish;
> $maxcount = $sth->rows;
> for ($i = 0; $i < $maxcount; $i++) 
> 	{

<snip>

For myself I would probably have approached it more like:

foreach $row (@{$row_ref})
  {
    if ( $row->[5] == 0 )
      {
        # whatever
      }
   }

Much neater than that nasty old 'C'-like for ...

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


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

Date: Tue, 27 Apr 1999 21:33:25 GMT
From: scraig@my-dejanews.com
Subject: Re: list of list
Message-Id: <7g5af5$i5a$1@nnrp1.dejanews.com>

In article <01be9090$8b352980$2bbe10ac@amipnet>,
  "Sheila  Eugenio" <seugenio@man.amis.com> wrote:
> let's say the actual returned values are (I have omitted 4 other cols):
> DAY 	INS		BOH
> 1	34668		637299
> 2       	67290		620574
> 1	97331		575218
> 2	102327	564416
> my $row_ref = $sth->fetchall_arrayref;
> $sth->finish;
> $maxcount = $sth->rows;
> for ($i = 0; $i < $maxcount; $i++)
> 	{
> 	if ($row_ref->[$i][5] == 0)
> 		{
> 		$row_ref_dct = "0";
> 		} else {
> 		$row_ref_dct = (($row_ref->[$i][3]+
> $row_ref->[$i][4])/2)/$row_ref->[$i][5];  ##compute CT
> 		}
> 		printf
> "<tr><td>$row_ref->[$i][0]<td><td>$row_ref->[$i][1]<td><td>$row_ref->[$i][2]
> <td><td>$row_ref->[$i][3]<td><td>$row_ref->[$i][4]<td><td>$row_ref->[$i][5]<
> td><td>%4.2f<td></td></tr>\n", $row_ref_dct;	##It's OK up to this part
> 		$ave_ins += $row_ref->[$i][2];
> 		$rng_ins  = $ave_ins/$row_ref->[$i][1];
>
> 		I want to print the $ave_ins and $rng_ins values after every 2
rows.

    You could use the modulus operator on the row number. Also that printf
statement is very ugly.

my $row_ref = $sth->fetchall_arrayref;
$sth->finish;
$maxcount = $sth->rows;
for ($i = 0; $i < $maxcount; $i++) {
    print "<tr>";

    for( my $j=0; $j<=5; ++$j ){
        print "<td>$row_ref->[$i][$j]</td>"; # Assuming </td> rather than <td>
    }

    if($row_ref->[$i][5] == 0){
        printf "<td>%4.2f</td></tr>\n", 0;
    }
    else {
        printf "<td>%4.2f</td></tr>\n",
            ($row_ref->[$i][3]+$row_ref->[$i][4])/2*$row_ref->[$i][5];
    }

    $ave_ins += $row_ref->[$i][2];
    $rng_ins  = $ave_ins/$row_ref->[$i][1];

    if( $i % 2 ){
         print "Average ins $ave_ins Rng Ins $rng_ins\n";
              # or whatever
         # Do you want to reset $ave_ins to 0 here?
    }
}

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


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

Date: 27 Apr 1999 20:49:58 GMT
From: Shaikh Sarmad <sarmad@fas.harvard.edu>
Subject: Re: newbie: Replace \n with <br>\n
Message-Id: <7g57tm$itl$1@news.fas.harvard.edu>

Rumour has it, Scott Oseychik <scott@simsbury.com> said:

>     $_ =~ s/\\n/<br>\\n/;

	s/\n/<br>\n/;

	\n  = new line
	\\n = back slash followed by 'n'


	sarmad :)

-- 
===========================================================================
 Sarmad M Shaikh                                       617.495.9647 (work)
 Manager, HSA Computer Services                        617.493.2453 (home)
 67 Mount Auburn Street                       http://hsa.net/comp_services
 Cambridge MA 02138                     http://www.fas.harvard.edu/~sarmad
===========================================================================


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

Date: Tue, 27 Apr 1999 14:28:11 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: newbie: Replace \n with <br>\n
Message-Id: <MPG.118fcbca99e8f06e989958@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7g56tg$fu1@news.dns.microsoft.com> on Tue, 27 Apr 1999 
16:27:52 -0700, Scott Oseychik <scott@simsbury.com> says...
> I would like to pre-pend every newline character (\n) with <br>, so the
> final result would be:    <br>\n

OK, good.  We answer Perl questions even when they deal with HTML.  :-)

> Here's my code so far, but I can't seem to get it to work:
> 
> #!c:\perl\bin -w

Good.  Next add 'use strict;'

> print ("Type in a file name: ");
> chomp($file = <STDIN>);
> open(FILEHANDLE,"+<$file") || die "Can't find $file!!\n";

Do you really want to open that file with write permission also?
Also, include $! in your error message, to see why the open fails.

> # for every newline character, replace it with
> # <br>, then a newline character
> 
> while (<FILEHANDLE>)
> {
>     $_ =~ s/\\n/<br>\\n/;

'$_ =~' is the default, and looks jarring to an experienced Perl 
programmer.  Just 's/\n/<br>\n/;' will do fine.

> }
> 
> close(FILEHANDLE);
> 
> This script doesn't seem to do anything, but doesn't generate any errors,
> either.  Sorry if this is a dumb question...

It is an easy question.  It isn't a dumb question, because you tried to 
solve it first before asking.

1.  I hope your code does more than you show, because changing $_ every
time through the loop affects nothing after the loop is completed.  You
have to do something with the result each time (print it, store it in an array,
whatever).

2.  Your regex is trying to match the two characters backslash-n.  To 
match the single character \n (newline), just use \n.   Also in the 
substitution side.

An even shorter way would be:

    s/$/<br>/;

because '$' matches before the \n at the end of the string.

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


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

Date: 27 Apr 1999 21:19:07 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: On the fly conversion
Message-Id: <7g59kb$dt$1@gellyfish.btinternet.com>

On Tue, 27 Apr 1999 11:29:31 -0600 Ashley M. Kirchner wrote:
> 
> 
>     I have a complete web site which is build using SSI's on all of its
> pages.  What I'd like to do is build a perl script that once passed one
> of these .shtml files, it'll do some tag stripping and present the same
> page again, will less bells and whistles...
> 
> 

I'd examine the module HTML::Parser or one of its children ,..

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


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

Date: Tue, 27 Apr 1999 20:57:35 GMT
From: homelessinseattle@my-dejanews.com
Subject: Re: Output from eval
Message-Id: <7g58bt$g29$1@nnrp1.dejanews.com>

In article <xxx-2704991328220001@rose.cac.psu.edu>,
  xxx@psu.edu (Linda Littleton) wrote:
> When I run the following code (where eval is evaluating something with a
> syntax error), an error message is getting printed to the screen. What I
> want is to capture all of the messages so that I can then handle the
> situation in a different way. How do I keep eval from writing out this
> stuff?
>
>   $calc = '5)8(';
>   local ($ans) = eval $calc;
>   print "Calc:   $calc\n";
>   print "Error:  $@\n" if ($@);
>   print "Answer: $ans\n";


2.try using using "select" to output to a different filehandle or
3.put a "| $error=$!;" after the commands you are trying to capture.
(P.S, there was no number "1." I like to start with "2.")

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


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

Date: 27 Apr 1999 20:29:18 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: problem with single quotes or abuse by programmer
Message-Id: <7g56mu$df$1@gellyfish.btinternet.com>

On Tue, 27 Apr 1999 11:45:46 +0930 Wyzelli wrote:
> Larry Rosler wrote in message ...
>>In article <37250AF5.5DA010B6@dataflo.net> on Mon, 26 Apr 1999 19:55:17
>>-0500, fire@dataflo.net <fire@dataflo.net> says...
>>> This version of code fails......???
>>> BEGIN {
>>>      push(@INC, 'C:\inetpub\wwwroot\mck-shared\');
>>>      push(@INC, 'C:\inetpub\wwwroot\test-mck\mck-cgi\');
>>> }
>>
>>So if you want to end your string with a backslash, use two of them.
>>But why not just use forward slashes in the first place?  It seems to be
>>one of the best-kept of the many secrets of PoBdom that except for the
>>dain-bread so-called command interpreters, forward slashes work fine.
> 
> It would seem to me that maximum portability would be achieved by \\ rather
> than / as those of us with 'dain-bread' systems wouldn't have a helluva time
> re-writing scripts to make them work.  Naturally you are forced into \'
> anyway...
> 

(Wyz can you try and put the stuff you are replying to above your reply
its a nuisance having to fix it and it does make things easier for people
whose news-spool expires quickly - 'this group isnt Jeopardy' whatever that
might be :)

Anyhow in virtually all cases *except* where you are going to give a
pathname to the command interpreter you can use the easier to use
forward slashes - infact DOS provided this function in INT 2F Function 12
Subfunction 04 to 'Normalize' the alternative path separator '/' ( I knew it
was there but I wish you hadnt made me look :) but you dont have to worry
about it - it all just works.  The whole thing gets sodded up when you
go to the command interpreter because of the stupid decision to use the /
as the 'Switch Char' and the strange way the interpreter parses its input
(indeed there is a DOS function to change the switch char as well but we
wont go there.)

I say 'virtually all cases' because I have a suspicion that some of the
Win32::* modules that deal with network resources require a '\'. Ho Hum.

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


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

Date: Tue, 27 Apr 1999 14:42:16 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: problem with single quotes or abuse by programmer
Message-Id: <MPG.118fcf16649fa9b2989959@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7g56mu$df$1@gellyfish.btinternet.com> on 27 Apr 1999 
20:29:18 -0000, Jonathan Stowe <gellyfish@gellyfish.com> says...
 ...
>           The whole thing gets sodded up when you
> go to the command interpreter because of the stupid decision to use the /
> as the 'Switch Char' and the strange way the interpreter parses its input

This / => \ and - => / is all part of the "MS-DOS's Not UNIX(TM)" [that 
would be a nice acronym -- MNU :-] syndrome of about 1980.  It may go 
back all the way to CP/M, but I doubt it.

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


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

Date: Tue, 27 Apr 1999 21:34:19 GMT
From: homeless <homelessinseattle@my-dejanews.com>
Subject: Re: question from a newbie
Message-Id: <7g5agr$i60$1@nnrp1.dejanews.com>

In article <7g3iu7$vkp$1@nnrp1.dejanews.com>,
  slash_ben@my-dejanews.com wrote:
> how can I print just two lines and all the lines in between them in a file?

here's a cheap-sleazy way of doing somthing of the sort, ben.

I'm assuming you're getting the 2 lines and info in between
from INFILE, and writing them out to OUTFILE.
#====================
my @inlines=<INFILE>;
my $flagset=0;
select OUTFILE;
foreach(@inlines)
{
     if (m/$firstlinetocopy/)#<-assign firstline to this variable
     {$flagset=1;}
     if ($flagset==1)
     {print;}
     if(m/$secondlinetocopy/)#<- ditto, with second.
     {$flagset=0;}
}
#====================

or something.


  homeless in seattle,
    "If it's not coffee-stained, it's not official."
     MySisterHasLice@homelessinseattle.com
--
  homeless in seattle,
    "If it's not coffee-stained, it's not official."

     MySisterHasLice@homelessinseattle.com

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


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

Date: Tue, 27 Apr 1999 14:10:55 -0700
From: Greg McCann <gregm@well.com>
Subject: Re: ROUNDING A NUMBER IN PERL
Message-Id: <372627DF.E463A5FB@well.com>

Rahul wrote:
> 
> How Do I round a number in perl?

Try perlfaq4:

http://language.perl.com/newdocs/pod/perlfaq4.html#Does_Perl_have_a_round_functio

For best results, bookmark for future reference.

Greg

-- 

======================
Gregory McCann
http://www.calypteanna.com

"Be kind, for everyone you meet is fighting a great battle."  Saint Philo of
Alexandria


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

Date: Tue, 27 Apr 1999 14:14:59 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: ROUNDING A NUMBER IN PERL
Message-Id: <MPG.118fc8ac42c63be1989957@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <37261FBC.276B2261@uswest.com> on Tue, 27 Apr 1999 13:36:12 -
0700, Rahul <rrahul@uswest.com> says...
> How Do I round a number in perl?

Would it surprise you to learn that this question has been asked before?  
So many times, in fact, that it is a Frequently Asked Question!

RTFFAQ.  perlfaq4: "Does Perl have a round() function? ...

And please, next time spare us this noise:
 
> begin:          vcard
 ...

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


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

Date: Tue, 27 Apr 1999 21:40:49 GMT
From: "JJ" <webdude@mcminn.net>
Subject: Server Overload
Message-Id: <B9qV2.3266$94.1358068@news1.usit.net>

I recieved this message from my ISP and was wondering if any of you guru's
can help me figure out what the cause is.

This script was running about 15 copies on our web server machine
since around 7:00pm last night, causing excessive load.  Please
take the script out of production or set some limits so this does not
happen.

Thanks,
 It appears to me he is referring to the fact that the script is not
stopping after it is executed resulting in multiple instances of the script
being open and staying open. Anyone have any ideas?




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

Date: Tue, 27 Apr 1999 17:10:34 -0400
From: Sushant Gargya <sushant@ntwrks.com>
Subject: sorting Label values in popup_menu
Message-Id: <372627CA.5DF25DD3@ntwrks.com>

Thanks for the response, Larry.
I double checked the max. characters/line within the browser and it is
set to 72......
Regarding sorting hash......I'm familiar with sorting hash,but forsome
reason the sort
does not seem to work when I try.....Here's the kinda stuff I've tried:
                $users = $query->popup_menu(-name=>'mID',
                 -values=>\@mList,
                 -labels=>(sort values(%mNames));
-------------------------------------------------
                $users = $query->popup_menu(-name=>'mID',
                 -values=>\@mList,
                 -labels=>(sort { $mNames{$a}<=>$mNames{$b} }
(%mNames));
Could you send me a 4-liner code that would work.....
Thanks again for taking time to respond.
-sushant



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

Date: Tue, 27 Apr 1999 14:41:47 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Text Counter
Message-Id: <37262F1B.1683F914@mail.cor.epa.gov>

Charlie Schulz wrote:
> 
> is it possible to have a texcounter looking at another page?

Yes.  Lots of people do it.  Some of them do it very badly.
Some of them only `think' they have a counter.

> i want to have a counter.html looking to the inde.html file.
> 
> how can i do it?

Well, for starters, you can ask in the right newsgroup.
Perl is not CGI, and this is a CGI question, even you
want this in Perl.  In other words, it is a web question
dressed in a llama's coat.  Perhaps the people in
comp.infosystems.www.authoring.cgi
might be willing to help you.  And some of them will
probably give you the right answer.

Also, you might look at some of Randal Schwartz's columns
for Web Techniques magazine.
 
> thanks

you're welcome,
David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Tue, 27 Apr 1999 14:35:30 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Where find a2p?
Message-Id: <37262DA2.87148B90@mail.cor.epa.gov>

Aaron Rappaport wrote:
> 
> Where can I find a2p for win95?  I found some DOCUMENTATION for it ok at
> CPAN, but no downloadable exe file.

That's because a2p typically comes with the Perl installation.

If you have ActiveState Perl, you will probably find a2p.exe in your
/bin directory.  That is, in the path\to\your\perl\build\bin
directory. If you don't see it, just let Explorer search for it...
Or use File::Find .

> Thanks

You're welcome,
David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

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


Administrivia:

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

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

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 5499
**************************************

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