[23319] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5539 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 22 00:05:49 2003

Date: Sun, 21 Sep 2003 21:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 21 Sep 2003     Volume: 10 Number: 5539

Today's topics:
    Re: "my" declarations, only matter of taste? (Tad McClellan)
    Re: "my" declarations, only matter of taste? (Tad McClellan)
    Re: "my" declarations, only matter of taste? <syscjm@gwu.edu>
    Re: $_ not changing in a foreach <bwaNOlSPtAMon@rochester.rr.com>
    Re: $_ not changing in a foreach (Tad McClellan)
    Re: Appropriate File Permissions (Tad McClellan)
        Can Filehandles Be Shared Between Threads? <mooseshoes@gmx.net>
    Re: D not deleting all breakpoints <bwaNOlSPtAMon@rochester.rr.com>
    Re: GD object problem <mgjv@tradingpost.com.au>
    Re: How fast is seek? (Tad McClellan)
        killing zombie file lock <ryantate@ryantate.com>
    Re: perl lib all over the place (ko)
    Re: simple server <bwaNOlSPtAMon@rochester.rr.com>
    Re: some stupid questions about string search & replace <spam@thecouch.homeip.net>
    Re: some stupid questions about string search & replace <mizhael@yahoo.com>
    Re: some stupid questions about string search & replace <mizhael@yahoo.com>
    Re: some stupid questions about string search & replace (Tad McClellan)
    Re: some stupid questions about string search & replace (Tad McClellan)
    Re: some stupid questions about string search & replace <tom@nosleep.net>
    Re: some stupid questions about string search & replace <uri@stemsystems.com>
    Re: This probably aint the right place  . . . but there <max@alcyone.com>
    Re: What are you allowed to share? <mooseshoes@gmx.net>
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 21 Sep 2003 17:26:05 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: "my" declarations, only matter of taste?
Message-Id: <slrnbms9bt.1rs.tadmc@magna.augustmail.com>

Eric J. Roode <REMOVEsdnCAPS@comcast.net> wrote:
> Matija Papec <mpapec@yahoo.com> wrote in 
> news:bfhrmvgre842llne5rde01ouhmejpr3b2r@4ax.com:
> 
>> 
>> a)
>> for (1..20) {
>>   my $mod = $_%3;
>>   ...
>> }
>> 
>> b)
>> my $mod;
>> for (1..20) {
>>   $mod = $_%3;
>>   ...
>> }


> Case (b) is generally preferred, since it can potentially save you 
        ^
        ^
> headaches.


I'm pretty sure Eric meant to type an "a" instead of a "b" there. 

Eric?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sun, 21 Sep 2003 17:30:46 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: "my" declarations, only matter of taste?
Message-Id: <slrnbms9km.1rs.tadmc@magna.augustmail.com>

Chris Richmond - MD6-FDC ~ <crichmon@filc8533.fm.intel.com> wrote:

> If 'my' is so great, 


It is not that lexical variables are so great.

It is that global variables (the alternative) are so bad.


> I catch typos on a fairly regular basis
> because I don't use 'my'.  


You catch typos on a fairly regular basis because every variable
in your program is a global variable.

That will cause you great pain at some point in time.

You can have both (lexicals and typo detection) if you "use strict"
which you should be already doing anyway.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sun, 21 Sep 2003 18:48:32 -0400
From: Chris Mattern <syscjm@gwu.edu>
Subject: Re: "my" declarations, only matter of taste?
Message-Id: <3F6E2AC0.9000406@gwu.edu>

Chris Richmond - MD6-FDC ~ wrote:
> If 'my' is so great, why does it disable the 'used only once'
> warning from perl -w?  I catch typos on a fairly regular basis
> because I don't use 'my'.  

If you'd use "use strict", you'd catch even more.  The idea
is to us "my" *and* "use strict".  That way every variable
you didn't declare rings the bell.

                        Chris Mattern



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

Date: Mon, 22 Sep 2003 01:26:28 GMT
From: Bob Walton <bwaNOlSPtAMon@rochester.rr.com>
Subject: Re: $_ not changing in a foreach
Message-Id: <3F6E4FB2.5080506@rochester.rr.com>

Sam wrote:

> Sam wrote:
> 
>> Hello
>>     foreach (@calc) {
>>       $total += $_;
>>     }
>> DB<70> p $_
>> is giving the same value for each loop of the code above. should itn't 
>> change its value to each item in the array @calc or I am missing 
>> somthing.
>>
>> any idea or hints...thanks alot
>>


I'm not sure exactly what you are trying to say.  

When the foreach is done, the value of $_ seems 

to revert to the value it had prior to the foreach 

(but I don't think that is guaranteed or documented).


Example:

    @calc=(2,4,6,8);
    $_=3;
    for(@calc){
	$total+=$_;
    }
    print "value is $_, total is $total\n";

prints "value is 3, total is 20" (on Windoze 98SE w/AS build 806).

$_ is aliased to the successive elements of @calc 

as the loop progresses.  You should not expect $_ 

to be set to the last element of the array when 

the loop terminates normally.  Is that what you 

were expecting?


> 
>  I fixed it
> it seams that in a previous line I had
>   my @list = @{ shift(@_) };
>   my $value = shift(@_);
> so I changed that to
>   my @list = @{ shift() };
>   my $value = shift();
> maybe the first case when I used @_ that set perl default variable $_ to 
>  a fixed value but when I removed @_ that freed it again.
> if I am not correct please correct me and explain why that had happend.
> 
> thanks
> 

As to the above comments, I'm afraid they make no sense to me at all. 
What relation does @list and $value have to the foreach loop code? None 
that's discernable to me.  Just as @_ has nothing to with $_.  There 
should be no difference between "shift()" and "shift(@_)", since @_ is 
the default argument for shift if the argument is omitted.  It is 
unclear what you were expecting and why you were expecting it.  Could 
you try again with a clear description, such as a short complete 
standalone program anyone can copy/paste/execute (like the one I put in 
above) that will illustrate your problem?

-- 
Bob Walton



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

Date: Sun, 21 Sep 2003 20:45:11 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: $_ not changing in a foreach
Message-Id: <slrnbmsl17.2g5.tadmc@magna.augustmail.com>

Bob Walton <bwaNOlSPtAMon@rochester.rr.com> wrote:

> When the foreach is done, the value of $_ seems 
> 
> to revert to the value it had prior to the foreach 
> 
> (but I don't think that is guaranteed or documented).


Sure it is, in the first paragraph of the description for
"Foreach Loops" in perlsyn.pod no less:

   ... the variable is implicitly local to the loop and regains its 
   former value upon exiting the loop.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sun, 21 Sep 2003 17:19:57 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Appropriate File Permissions
Message-Id: <slrnbms90d.1rs.tadmc@magna.augustmail.com>

Robert TV <ducott_99@yahoo.com> wrote:
> "Tad McClellan" <tadmc@augustmail.com> wrote:


>> What is your Perl question?
> 
> ??? Two inquiries in my original post:
> 
> - I'm curious as to the correct file permissions I should be using.


If you were using Python instead of Perl, the answer to that
question would still be the same.


> - Should I be using 755 for perl scripts and 777 for the text files?


If you were using Python instead of Perl, the answer to that
question would still be the same.


You do not have a Perl question.

You have a question about filesystem permissions for CGI programming.

You should ask your question in a newsgroup about CGI programming such as:

      comp.infosystems.www.authoring.cgi


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Mon, 22 Sep 2003 00:44:33 GMT
From: mooseshoes <mooseshoes@gmx.net>
Subject: Can Filehandles Be Shared Between Threads?
Message-Id: <QBrbb.7$F51.2645221@newssvr14.news.prodigy.com>

All:

I'm having good success sharing variables across threads with the
exception of filehandles.  I have tried creating filehandles in a couple
of way including using the FileHandle module and a plain old "open $fh".
This mini-simulation illustrates the problem.

<code snipettes>

use threads;
use threads::shared;
use FileHandle;

my $fh = new FileHandle; #also tried "my $fh : shared = new FileHandle;"
my %hash : shared;
my $index;

$hash{$index} = \$fh; #also tried setting substituting scalar reference
                      #my $fh_ref = \$fh to avoid issues with objects

results in:

"thread failed to start: Invalid value for shared scalar at module line
614, <$client> line 1."

I need to move filehandles.  Any ideas?

Best,

Moose






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

Date: Mon, 22 Sep 2003 01:01:26 GMT
From: Bob Walton <bwaNOlSPtAMon@rochester.rr.com>
Subject: Re: D not deleting all breakpoints
Message-Id: <3F6E49D3.3020108@rochester.rr.com>

Sam wrote:

 ...
> DB<45>D
> DB<45>L
> still lists the 3 breakpoints I have had and the code stops at them.
> how can I delete all breakpoint. it seams the D switch is not working.
 ...

What D switch?  I think you mean "B *" .  And it does work, at least in 
Windoze 98SE with AS build 806.

-- 
Bob Walton



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

Date: 22 Sep 2003 02:48:37 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: GD object problem
Message-Id: <slrnbmsoo7.7ha.mgjv@verbruggen.comdyn.com.au>

On 19 Sep 2003 12:10:53 -0700,
	Vesselin Baev <vesko_baev@abv.bg> wrote:
> Hello to All,
> Baybe I'm not alone with this message error when I started the script:
> Can't locate loadable objest for module GD...

GD is not installed correctly, or your environment is not set up
correctly. Neither of the two is really a Perl problem, or something
that can be fixed without access to your machine.

How did you install GD? Did you do it yourself? Did you run the tests?
If you ran it as root, what umask was in effect? Did you link libgd in
dynamically, and if so, is your environment set up correctly to find
libgd?

> I've noticed that in the forum there is a lot of people with the same
> problem but I did't find the solution for it!

The problem is most often that people have not correctly installed GD.
Then there are a myriad of other possible problems that could cause
this.

> We using Linux SuSE, and we have the latest version of Perl. We
> installed the GD package and we have also the libgd files (I've
> checked that)!

Show us the sequence of events that got you to where you are now, and
include some version numbers (Perl, libgd, GD). Maybe talk to your
system admin.

Martien
-- 
                        | 
Martien Verbruggen      | Little girls, like butterflies, need no
Trading Post Australia  | excuse - Lazarus Long
                        | 


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

Date: Sun, 21 Sep 2003 17:38:44 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: How fast is seek?
Message-Id: <slrnbmsa3k.1rs.tadmc@magna.augustmail.com>

David Morel <altalingua@hotmail.com> wrote:

> seek FILEHANDLE,POSITION,WHENCE
> 
> How fast is seek?


As fast as your OS can make it.

Did you mean to ask if there is a faster alternative or something?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Mon, 22 Sep 2003 01:07:28 +0000 (UTC)
From: Ryan Tate <ryantate@ryantate.com>
Subject: killing zombie file lock
Message-Id: <bkli0g$tff$1@agate.berkeley.edu>

I have a perl script that runs reports on a log file. It locks this
file with

(flock $fh, LOCK_EX|LOCK_NB) or die "Could not lock file: $!";

Several days ago I invoked the script via CGI. While my browser was
still receiving lines from the script, and before it had time to
finish its run, I hit "Stop" in my browser, presumably before the
filehandle could close and release the lock. Ever since, the script
cannot get a new lock on the file. I get the $! error "Resource
temporarily unavailable." When I remove the lock code from my script,
it works as it did before.

So I suspect I have a days-old zombie lock still tying up the file,
and I want to know how to get rid of it.

I have tried running the script with LOCK_UN in place of LOCK_EX, but
I don't think this is what I'm looking for. I have tried ps -u
myusername at the console and don't see any unusual
processes to kill.

I have no idea what the lock file name would be for my platform, SunOS
5.8, otherwise I would rm the file manually.

I have tried looking this up in:
*The Camel
*Usenet archive for c.l.p* and generally for unix, sunos and solaris
*FAQ for this group
*flock manpage for my system (which seems to describe a C api call,
not an actual utility)
*Unix System Administrator Handbook, 3rd ed, Nemeth, Snyder, Seebass &
Hein

Anyone have any suggestions?

Gratefully,
RT


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

Date: 21 Sep 2003 18:10:33 -0700
From: kuujinbo@hotmail.com (ko)
Subject: Re: perl lib all over the place
Message-Id: <92d64088.0309211710.281dc427@posting.google.com>

Sam <samj2@austarmetro.com.au> wrote in message news:<3F6D22AE.20806@austarmetro.com.au>...
> ko wrote:
>  > On an off topic note, I just saw your post regarding browsing the perl
>  > documentation. If you don't find the 'perldoc...' interface intuitive,
>  > may I suggest that you try http://www.perldoc.com/ ? It may be easier
>  > to browse the documentation in HTML, and there is documentation for
>  > the last six versions of Perl. The 'Perl Manpage' link takes you to
>  > Perl's *core* documentation.
>  >
>  > HTH - keith
> 
> 
> in regarding to browsing the perl docs. www.perldoc.com does not support
>    packages which is not part of the core perl disto...correct?
> if so, do I have another chance with not core modules.
> I am now using $man Date::Calc and it has above 60 items in the main
> array, I would like to be able to click on an item and it takes me to
> more explanation about what it is and it does. it is very hard when I
> cann't even search the man page of a module or can I?

Besides serving as a repository for modules, CPAN has a nice search
feature and has HTML documentation:

http://search.cpan.org/

Not sure what you mean when you say that you can't search the manpage
of a module. I know you're new to Perl and *nix and I can definitely
relate to sometimes being overwhelmed by learning so many new things
at once, but I *strongly* suggest that you hit learning your OS shell
commands harder because some of the questions you've been posting are
not strictly Perl related. Consequently, your questions may start to
go unanswered. Its time-consuming and at times frustrating, but I find
that I learn a lot more by spending that extra bit of time trying to
find/fix my mistakes/problems rather than having someone else give me
the answers. You tend to remember something that took you an hour to
fix :) And you *can* search any manpage on your system, since man uses
a pager program (more, less, etc) that has search capabilities.

One last thing. Learn Perl's *basic* concepts and contructs before you
start trying to use higher level contructs and modules. I think I saw
in one of your other posts that you have 'Programming Perl'? Read the
first few chapters over and over till you understand. Don't take this
personally - I had to do the same and still browse through them from
time to time. The point being that you can't expect to write a script
of any level of complexity without *first* knowing the basics. The
experts in the group 'preach' what some newcomers feel is 'dogmatic
programming' for good reason - it saves you time and frustration in
the end, and makes you a better programmer.

You seem really motivated to learn Perl, so good luck - keith


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

Date: Mon, 22 Sep 2003 02:47:46 GMT
From: Bob Walton <bwaNOlSPtAMon@rochester.rr.com>
Subject: Re: simple server
Message-Id: <3F6E62BE.3040509@rochester.rr.com>

D Borland wrote:

 ...
> I am looking to create database (probably) using SQLlite and perl and it's
> interface.  What i would like to know is there any way with perl for me to
> create a simple server, so i could say open a local file form the harddrive
> in my webbrowser, then click on a link to execute a perl script which will
> in turn return data to the current browser process.
 ...
> D Borland
 ...


It isn't very good, but it is an all-Perl web server.  Put it in the 
same directory as your HTML files (*.html) and Perl CGI files (*.cgi):

use HTTP::Daemon;
use IPC::Open2;
$|=1;
my $server=HTTP::Daemon->new(LocalPort=>80,LocalAddr=>'localhost');
print "Please contact me at <URL:", $server->url, ">\n";
while($client=$server->accept){
	while(my $answer=$client->get_request){
		$ans=$answer->as_string;
		@ans=split /\n/,$ans;
		$client->autoflush;
		if($answer->method eq 'GET'){
			$path=$answer->url->path;
			(error,last) unless $path=~s#^/##;
			if($path=~/html$/i){
				$client->send_file_response($path);
				last;
			}
			if($path=~/cgi$/i){
				$ENV{REQUEST_METHOD}=$answer->method;
				$query=$answer->url->query;
				$ENV{CONTENT_LENGTH}=length($query);
				$ENV{QUERY_STRING}=$query;
				$out=`perl $path`;
				$out=~s/.*?\n\n//s; #remove HTTP header
				print $client $out;
				last;
			}
		}
		if($answer->method eq 'POST'){
			$path=$answer->url->path;
			(error,last) unless $path=~s#^/##;
			if($path=~/cgi$/i){
				$query=$answer->url->query;
				$ENV{REQUEST_METHOD}=$answer->method;
				for(@ans){
					$ENV{CONTENT_LENGTH}=$1 if /Content-Length: (\d+)/;
					$ENV{HTTP_REFERRER}=$1 if /Referer: (.*)/;
				}
				$query=$ans[-1];
				undef $CGI;undef $OUT;
				$pid=open2($CGI,$OUT,"perl","$path") or error;
				print $OUT $query;
				close $OUT;
				@out=<$CGI>;
				waitpid $pid,0;
				$out=join "\n",@out;
				$out=~s/.*?\n\n//s; #remove HTTP header
				print $client $out;
				last;
			}
		}
		last;
	}
	print "CLOSE: ", $client->reason, "\n" if $client->reason;
	undef $client;
}

sub error{
	$client->error(RC_FORBIDDEN);
	print "An error occurred in $ans\n";
}

-- 
Bob Walton



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

Date: Sun, 21 Sep 2003 18:29:32 -0400
From: Mina Naguib <spam@thecouch.homeip.net>
Subject: Re: some stupid questions about string search & replace in perl
Message-Id: <eDpbb.10192$112.442527@wagner.videotron.net>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

walala wrote:

[Re-located.  Please do NOT top-post. Your writing should go BELOW the part you're writing about]

> 
>>>3. Suppose there are two lines in my text file:
>>>
>>>M1834 S_4 47 52 VDD!  PCH  L=239.99999143598E-9 W=3.99999998990097E-6 \
>>>AD=2.04320002757108E-12 AS=1.58200004745507E-12 PD=5.36000015927129E-6 \
>>>PS=829.999976303952E-9 NRD=+2.50000001E-01 NRS=+2.50000001E-01 M=1.0
>>>
>>>I want to change the "\ ^n" ( The "\" plus an "LF" at the end of each
> 
> line)
> 
>>>to "^n +" (first do an "LF", then add a "+" to the front of each line)
>>
>>$data =~ s/\\\n/\n+/g;
>>
>>See perldoc perlop
>>
 >
 > Dear Mina,
 >
 > sorry, for that problem 3, I guess what I want is to remove the "\" at the
 > end of each line and add a "+" to the beginning of the next line(not the
 > front of that line, but next line)...
 >
 > Can you statement still do the work?

Assuming that the whole chunk of data is in $data, yes.

-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE/biZOeS99pGMif6wRAnXsAKDxp1QdG+hJlQ19MaPYod4gQVY/ywCgtTY6
rYprI0ASxozaeC9KKIRqDi8=
=pqFl
-----END PGP SIGNATURE-----



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

Date: Sun, 21 Sep 2003 20:36:47 -0500
From: "walala" <mizhael@yahoo.com>
Subject: Re: some stupid questions about string search & replace in perl
Message-Id: <bkljn2$jub$1@mozo.cc.purdue.edu>

Mina,

I guess our program should only read line-by-line... The reason is that I am
going to use this program run on a big input file which is 15MByte in
size... can I take in the whole chunk of data all at once?

Thank you,

-Walala

"Mina Naguib" <spam@thecouch.homeip.net> wrote in message
news:eDpbb.10192$112.442527@wagner.videotron.net...
> -----BEGIN xxx SIGNED MESSAGE-----
> Hash: SHA1
>
> walala wrote:
>
> [Re-located.  Please do NOT top-post. Your writing should go BELOW the
part you're writing about]
>
> >
> >>>3. Suppose there are two lines in my text file:
> >>>
> >>>M1834 S_4 47 52 VDD!  PCH  L=239.99999143598E-9 W=3.99999998990097E-6 \
> >>>AD=2.04320002757108E-12 AS=1.58200004745507E-12 PD=5.36000015927129E-6
\
> >>>PS=829.999976303952E-9 NRD=+2.50000001E-01 NRS=+2.50000001E-01 M=1.0
> >>>
> >>>I want to change the "\ ^n" ( The "\" plus an "LF" at the end of each
> >
> > line)
> >
> >>>to "^n +" (first do an "LF", then add a "+" to the front of each line)
> >>
> >>$data =~ s/\\\n/\n+/g;
> >>
> >>See perldoc perlop
> >>
>  >
>  > Dear Mina,
>  >
>  > sorry, for that problem 3, I guess what I want is to remove the "\" at
the
>  > end of each line and add a "+" to the beginning of the next line(not
the
>  > front of that line, but next line)...
>  >
>  > Can you statement still do the work?
>
> Assuming that the whole chunk of data is in $data, yes.
>
> -----BEGIN xxx SIGNATURE-----
> Version: GnuPG v1.2.1 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQE/biZOeS99pGMif6wRAnXsAKDxp1QdG+hJlQ19MaPYod4gQVY/ywCgtTY6
> rYprI0ASxozaeC9KKIRqDi8=
> =pqFl
> -----END PGP SIGNATURE-----
>




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

Date: Sun, 21 Sep 2003 20:37:41 -0500
From: "walala" <mizhael@yahoo.com>
Subject: Re: some stupid questions about string search & replace in perl
Message-Id: <bkljop$jut$1@mozo.cc.purdue.edu>

Daer John,

sorry, for that problem 3, I guess what I want is to remove the "\" at the
end of each line and add a "+" to the beginning of the next line(not the
front of that line, but next line)...

Can you statement still do the work?

Thanks a lot,

-Walala


"John W. Krahn" <krahnj@acm.org> wrote in message
news:3F6E0002.212FB250@acm.org...
> walala wrote:
> >
> > I have been learning Perl for several days by reading online
tutorials...
> > now when I really need it to some serious work, I found I still have a
bunch
> > of questions:
> >
> > 1. How to make a string all to "UPPER CASE"?
>
> $string = uc $string;
>
> perldoc -f uc
>
>
> > 2. Suppose there is a "(" (bracket character) in the string $str, and I
want
> > to remove it, how can I do that?
>
> $string =~ s/\(//;  # remove first '(' character
>
> $string =~ tr/(//d; # remove all '(' characters
>
> perldoc perlre
> perldoc perlop
>
>
> > 3. Suppose there are two lines in my text file:
> >
> > M1834 S_4 47 52 VDD!  PCH  L=239.99999143598E-9 W=3.99999998990097E-6 \
> > AD=2.04320002757108E-12 AS=1.58200004745507E-12 PD=5.36000015927129E-6 \
> > PS=829.999976303952E-9 NRD=+2.50000001E-01 NRS=+2.50000001E-01 M=1.0
> >
> > I want to change the "\ ^n" ( The "\" plus an "LF" at the end of each
line)
> > to "^n +" (first do an "LF", then add a "+" to the front of each line)
> >
> > The result is:
> >
> > M1834 S_4 47 52 VDD!  PCH  L=239.99999143598E-9 W=3.99999998990097E-6
> > +AD=2.04320002757108E-12 AS=1.58200004745507E-12 PD=5.36000015927129E-6
> > +PS=829.999976303952E-9 NRD=+2.50000001E-01 NRS=+2.50000001E-01 M=1.0
> >
> > How can I do that?
>
> while ( <> ) {
>     s/\s*\\\s+\z/\n +/;
>     }
>
>
>
> John
> -- 
> use Perl;
> program
> fulfillment




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

Date: Sun, 21 Sep 2003 20:49:45 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: some stupid questions about string search & replace in perl
Message-Id: <slrnbmsl9p.2g5.tadmc@magna.augustmail.com>

walala <mizhael@yahoo.com> wrote:


[ snip yet more top-posting ]


> "Mina Naguib" <spam@thecouch.homeip.net> wrote in message
> news:eDpbb.10192$112.442527@wagner.videotron.net...
>> walala wrote:
>>
>> [Re-located.  Please do NOT top-post. Your writing should go BELOW the
> part you're writing about]


Do you know what "top post" means?

If not, ask.

If so, then please honor the request to stop doing it. Soon.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sun, 21 Sep 2003 20:51:12 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: some stupid questions about string search & replace in perl
Message-Id: <slrnbmslcg.2g5.tadmc@magna.augustmail.com>

walala <mizhael@yahoo.com> wrote:

> going to use this program run on a big input file which is 15MByte in


15Mb is not "big" in most contemporary circles...


> size... can I take in the whole chunk of data all at once?


That depends on how much memory you have on your machine, there
is no limit builtin to perl.



[ snip rude TOFU ]

-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sun, 21 Sep 2003 19:10:43 -0700
From: "Tom" <tom@nosleep.net>
Subject: Re: some stupid questions about string search & replace in perl
Message-Id: <3f6e5977@nntp0.pdx.net>

tp gestapo

">     Tad McClellan                          SGML consulting
>     tadmc@augustmail.com                   Perl programming
>     Fort Worth, Texas

tp gestapo




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

Date: Mon, 22 Sep 2003 03:53:29 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: some stupid questions about string search & replace in perl
Message-Id: <x7llshmqbq.fsf@mail.sysarch.com>

>>>>> "T" == Tom  <tom@nosleep.net> writes:

  T> tp gestapo
  T> ">     Tad McClellan                          SGML consulting
  >> tadmc@augustmail.com                   Perl programming
  >> Fort Worth, Texas

  T> tp gestapo

<plonk>

godwin's law is in effect

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org
Damian Conway Class in Boston - Sept 2003 -- http://www.stemsystems.com/class


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

Date: Sun, 21 Sep 2003 16:54:07 -0700
From: Erik Max Francis <max@alcyone.com>
Subject: Re: This probably aint the right place  . . . but there's no real  newsgroup for MySQL
Message-Id: <3F6E3A1F.7A2D9F7@alcyone.com>

Michael Budash wrote:

> he said: "my lame ISp never so much as answers my questions", not: "my
> lame ISp won't teach me programming and it's their responsibility".

That's right.  Yet the question he had was about programming, not
something related to his ISP's technical support.

-- 
   Erik Max Francis && max@alcyone.com && http://www.alcyone.com/max/
 __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/  \ Show me this is / A love forever
\__/  Nik Kershaw


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

Date: Mon, 22 Sep 2003 00:38:18 GMT
From: mooseshoes <mooseshoes@gmx.net>
Subject: Re: What are you allowed to share?
Message-Id: <_vrbb.9818$ey.153743636@newssvr13.news.prodigy.com>


David:

Watch for my similar post to yours.  I am having the same issue.

Let's share notes if a solution appears.

Best,

Moose









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

Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: 
Message-Id: <3F18A600.3040306@rochester.rr.com>

Ron wrote:

> Tried this code get a server 500 error.
> 
> Anyone know what's wrong with it?
> 
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {

(---^


>     dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
 ...
> Ron

 ...
-- 
Bob Walton



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

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


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