[7176] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 801 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 31 18:22:15 1997

Date: Thu, 31 Jul 97 15:00:26 -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           Thu, 31 Jul 1997     Volume: 8 Number: 801

Today's topics:
     Re: [Q] Can you generate "page.html#bottom" in PERL? <rootbeer@teleport.com>
     Re: Adding a character to a character class (Charles DeRykus)
     Re: Adding a character to a character class (Tad McClellan)
     Re: Any nice "Powered by Perl" gifs? <jeff@webdesigns1.com>
     Re: Communication between parent and child <rootbeer@teleport.com>
     Computer Books mlm47@columbia.edu
     Re: easy Question (David Siebert)
     Re: file locking - how does it act? (Charles DeRykus)
     Getting variables from checkboxes??? (Burt Lewis)
     input without a carriage return. <pauld@itsnet.com>
     Re: io/pipe...FAILED test 9 <rootbeer@teleport.com>
     Re: keyboard input without carriage return (A. Deckers)
     keys/values 2 hashes <gland@ccs.neu.edu>
     Re: Looking for a routine to trim white space  (like VB (Mick Farmer)
     Re: open a url <rootbeer@teleport.com>
     pattern matching <cferry@cs.strath.ac.uk>
     Re: pattern matching <dan@clockwork.net>
     Perl and MS Personal Web Server/Win 95 <growe@mic.dundee.ac.uk>
     Re: perl on Win32 - fork() (dave)
     Re: Perl Script with Netscape 4.01 <rootbeer@teleport.com>
     Question ? <paul@flinet.com>
     Question ??? <paul@flinet.com>
     Re: Regexp (Tad McClellan)
     Re: Removing Carriage Returns??? (Maelstrom)
     Re: send mail from perl (Felix Morley Finch)
     Stripping ^M from a variable. How? (Ryan Lynch)
     syslog or syslogd (Mark Kogon)
     Re: Too many people in this group are arrogant #*(@# (R Steve_Kilbane@cegelecproj.co.uk
     Re: Unexecuted stmt adds array elem?? (Dave Hollenbeck)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 30 Jul 1997 09:19:40 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: bowker@iNetWebInc.com
Subject: Re: [Q] Can you generate "page.html#bottom" in PERL?
Message-Id: <Pine.GSO.3.96.970730091703.23957J-100000@kelly.teleport.com>

On Tue, 29 Jul 1997 bowker@iNetWebInc.com wrote:

> In raw HTML, I can send a visitor back to some spot part way down the
> page by
> 
> <a href="page.html#bottom">CLICK HERE</a>
> 
> But if I'm generating the HTML code with PERL, is it possible to jump
> part way down the page like that?

That sounds like a question about how HTML works, rather than about Perl.
You could either ask in an HTML newsgroup or you could write a test
program and find out. The latter should be faster, and probably more
accurate. :-)  (But be sure to read the HTML specs about the format of 
internal anchors first.) Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 31 Jul 1997 02:41:36 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Adding a character to a character class
Message-Id: <EE5wtD.8tw@bcstec.ca.boeing.com>

In article <870289595.20896@dejanews.com>,  <jmack@p3.net> wrote:
 >Can I somehow add a dash ( - ) to the \w character class.  I want the \w
 >to work the same, but simply match a dash as well as all the rest.
 >
 >Thanks for any advice,
 >

You could create your own character class consisting of and - and \w :  

     [-\w] 

or, even parameterize your special class for brevity  , e.g, :  

     $c = '[-\w]' 

and then substitute $c in the regular expression.


HTH,
--
Charles DeRykus
ced@carios2.ca.boeing.com


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

Date: Wed, 30 Jul 1997 17:33:47 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Adding a character to a character class
Message-Id: <bgfor5.p93.ln@localhost>

jmack@p3.net wrote:
: Can I somehow add a dash ( - ) to the \w character class.  I want the \w
: to work the same, but simply match a dash as well as all the rest.


1) just use [\w-] instead of \w


2) perl comes in source code form, poke around in there before you
   build it  ;-)


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Wed, 30 Jul 1997 09:22:39 -0500
From: "Jeff Oien" <jeff@webdesigns1.com>
Subject: Re: Any nice "Powered by Perl" gifs?
Message-Id: <5rnihr$306@newsops.execpc.com>

 If there aren't any out there I wouldn't mind making one.
--
Jeff Oien, WebDesigns
http://www.webdesigns1.com/
jeff@webdesigns1.com

nospam@domain.com wrote in article <5rmbfb$rpf$1@news2.voicenet.com>...

>Has anyone ever seen any nice "Powered by Perl" gifs?
>
>(Maybe with a really muscular-looking camel...)
>--
>##--------------------------------
>##  J o h n   N o l a n
>##  jpn acm org
>##--------------------------------




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

Date: Thu, 31 Jul 1997 08:54:56 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Sun Jian <eng50636@leonis.nus.sg>
Subject: Re: Communication between parent and child
Message-Id: <Pine.GSO.3.96.970731084615.20106U-100000@kelly.teleport.com>

On 31 Jul 1997, Sun Jian wrote:

>   I have a parent process who creates a child process. 
> 
> In my program, there is a variable $flag. When the value of $flag is
> changed in the child process, it seems that the parent process doesn't
> know and it still sees $flag with its original value.

That's right; the two are independant processes after the fork.

> I would like to know what is the easiest method for the parent and the
> child to 'share' the variable so that when it's changed in either
> process, the other process is able to see the change immediately. 

Probably the easiest way is to tie the variable to a package which
implements something from the perlipc(1) manpage. If there isn't already a
module to do this, there should be. (I don't know whether IPC::Globalspace
will do this when it's available.)

Until you find such a module, the methods in perlipc should help. After
you've read that manpage, if you have more questions please post again.
Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 30 Jul 1997 22:36:35 -0600
From: mlm47@columbia.edu
Subject: Computer Books
Message-Id: <870319228.18976@dejanews.com>

I am setting up a webpage that lists some of the best books for webpage
design and development and I would love to get input from people for book
recommendations.

I figure books about C, perl, CGI, Java, HTML etc. are all relevant.

You will notice I have already begun making lists of other types of books
when you go to my homepage.  Just click in the internet book page to see
what I have already.  Thanks for the help.

http://www.columbia.edu/~mlm47/

-M

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: 31 Jul 1997 21:00:29 GMT
From: dsiebert@gate.net (David Siebert)
Subject: Re: easy Question
Message-Id: <5rqudd$104s$1@news.gate.net>

In article <5rpjrs$51j@newstoo.ericsson.se>, etltsln@etlxd30.ericsson.se 
says...
>
>David Siebert (dsiebert@gate.net) wrote:
>: How do I read the first letter of a perl string? I don't want to extract it 
>: I just read it into a varable.
>: Thanks
>
>Hi David,
>        There are numerous ways of carrying out this task,
>        here's one.
>
>        $string="foo\n";
>        $firstchar=substr($string,0,1);
>        
>        Buy the Camel book if you wish to get more exotic.
>
>                        Regards Tom
>
>

Thank you I am going to have to get the Camel Book. I have already turned out 
my first cgi script and my boss has gotten a bunch af "Great Ideas" for our 
website.



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

Date: Thu, 31 Jul 1997 02:00:47 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: file locking - how does it act?
Message-Id: <EE5uxC.6Mo@bcstec.ca.boeing.com>

In article <EE5DF9.51z@bcstec.ca.boeing.com>,
Charles DeRykus <ced@bcstec.ca.boeing.com> wrote:
   >In article <33DECDFF.C8BF50C9@nmia.com>,  <soki@nmia.com> wrote:
       > > Let's say I do something like this...
       > > 
       > > #!/usr/bin/perl
       > > open(FU, "bar");
       > > flock(FU, 2);
       > > @fubar = <FU>;
       > > close(FU);
       > > 
       > > push @fubar, "Hello.\n";
       > > ...
       > > 
       > > Will the file "bar" still be locked until the script finishes?
       > > 
  >Yes.

Um, I interpreted "finishes" to mean "finishes with the locked file".  
Actually, closing the filehandle releases the lock so the
answere is "No". 

HTH,
--
Charles DeRykus
ced@carios2.ca.boeing.com


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

Date: 31 Jul 1997 15:52:28 GMT
From: Burt lewis@ici.net (Burt Lewis)
Subject: Getting variables from checkboxes???
Message-Id: <5rqcbs$bfu$1@bashir.ici.net>

I have a script that reads from a variable length text file and outputs an 
HTML table based on the records in the file.  That works fine!

I also include a checkbox for each line which I name in increments.
(del1,del2,del3,etc.)

Problem is that I'm not sure how I can capture these variables not knowing 
how many lines I will have to be read. I can't get the foreach looping.

This is a sample of the finished HTML file:
===========================================
<input type=checkbox name=del13></td><td width=1% font 
size=3><b>6/30/97</td><td width=1%> 
<input type=checkbox name=del14></td><td width=1% font 
size=3><b>6/30/97</td><td width=1%> 
<input type=checkbox name=del15></td><td width=1% font 
size=3><b>6/30/97</td><td width=1%> 

This is what my script looks like:
====================================
#!/usr/local/bin/perl 

$infile= "/files/WWW/vhtdocs/eastonmass/notes/data.txt";
print "Content-type: text/html\n\n";
if(! $ENV{'QUERY_STRING'}) { 
#   &getlast;
   &main;
}


if($ENV{'QUERY_STRING'} eq "delete") { ##### This is where I need help
   &parse_form;
   &get_variables;
   print "test";

   exit;
}

else {
   &parse_form;
   &get_variables;
   exit;
}





sub main
{
print "Content-type: text/html\n\n";
print "$ENV{'SCRIPT_NAME'}";
print "$ENV{'CONTENT_LENGTH'}";
print "<html><head><title>Your Notes</title></head>\n";
print "<body>\n";
print "<FORM Method=POST Action=\"$ENV{'SCRIPT_NAME'}?delete\">\n";
print "<center><b><font face=ariel size=7>Your Notes</b>\n";
print "<center>\n";
print "<table cellspacing=5 cellpadding=5 border=1 width=100%>\n";
print "<tr><td width=1%><font face=ariel size=3><center><b>#</b></td><td 
width=1%><font face=ariel size=3><center><b></b></td><td width=1%><font 
face=ariel size=3><center><b>Date</b></td><td width=1%><font face=ariel 
size=3><center><b>Time</b></td><td width=70%><font face=ariel 
size=3><center><b>Note</td></tr>\n";
open (FILE,"$infile" ) || die "can't open $indexurl: $!\n";
$_ = (<FILE>);

while (<FILE>)
{
chop;
($number, $date, $time, $body,) = split(/"/,$_,4);

print "<tr><td width=1% font size=3><b>$number</td><td width=1%><input 
type=checkbox name=del$number></td><td width=1% font size=3><b>$date</td><td 
width=1% font size=3><b>$time</td><td width=20% font 
size=3><b>$body</td></tr>\n";
}
print "</table>\n";
#print "</OPTION></SELECT>\n";      
print "<P><CENTER><INPUT Type=Submit Value=\"Perform 
Action\"></CENTER><BR>\n";
print "</form>\n";
print "<b>Return to: <A HREF=http://www.eastonmass.com/notes/notes1.htm>Main 
Menu</A>\n";
print "</body></html>";
}


# Parse Form Subroutine
###############################################################
sub parse_form {
   # Get the input
    read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

   # Split the name-value pairs
   @pairs = split(/&/, $buffer);

   foreach $pair (@pairs) {
      ($name, $value) = split(/=/, $pair);

      if($name eq "dtopic") {
         push(@dtopics,$value);
      }
      if($name eq "fdelete") {
         push(@filesd,$value);
      }
      # Un-Webify plus signs and %-encoding
      $value =~ s/\//_/g;
      $value =~ tr/+/ /;
      $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
      $value =~ s/<!--(.|\n)*-->//g;
      $FORM{$name} = $value;
   }
}
####################################################################
sub get_variables {
 
 
 if ($FORM{'body'}) {
      $body = $FORM{'body'};
      $body =~ s/[\r\n]/ /g;
      }  
 
}

######
#Delete Subroutine
######
sub del
{


}




I know this is some sort of a foreach statement and would appreciate it if 
someone could point me in the right direction.

Thanks!

Burt Lewis
burt@ici.net




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

Date: Thu, 31 Jul 1997 14:50:53 -0700
From: "Paul R. DeBry" <pauld@itsnet.com>
Subject: input without a carriage return.
Message-Id: <33E108BD.2BC1@itsnet.com>

--Perhaps this is a stupid question, but does anyone know how to receive
input from the keyboard one character at a time with requiring a a
carriage return after each character.

Any help would be GREATLY appreciated.

--Gordon Harkness


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

Date: Thu, 31 Jul 1997 09:13:25 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: John Mohr <jmohr@grizzly.ccsd.k12.wy.us>
Subject: Re: io/pipe...FAILED test 9
Message-Id: <Pine.GSO.3.96.970731091223.20106W-100000@kelly.teleport.com>

On Wed, 30 Jul 1997, John Mohr wrote:

>     local $SIG{PIPE} = 'IGNORE';
>     open NIL, '|true'	or die "open failed: $!";
>     sleep 2;
>     print NIL 'foo'	or die "print failed: $!";
>     if (close NIL) {          <--------------------------caused failure of test.
> 	print "not ok 9\n";
>     }

Maybe you don't have the program 'true' in your PATH. Could that be it?
Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 31 Jul 1997 21:47:35 GMT
From: I-hate-cyber-promo@man.ac.uk (A. Deckers)
Subject: Re: keyboard input without carriage return
Message-Id: <slrn5u21vm.rfi.I-hate-cyber-promo@news.rediris.es>

In <33E11408.17F@itsnet.com>,
	Paul R. DeBry <pauld@itsnet.com> wrote:
>This may be a stupid question, but how do you receive input from the
>keyboard without requiring a carriage return.
>
>All I want is a way to know that a key was pressed and what key it was!
>
>Any help would be GREATLY appreaciated.

I'll help you to help yourself. :-) The answer is in the Perl FAQ. Read
the FAQ.  The FAQ is good for you.

HTH,

ALain

-- 
Perl information: <URL:http://www.perl.com/perl/>
    Perl archive: <URL:http://www.perl.com/CPAN/>
        Perl FAQ: <URL:http://www.perl.com/CPAN/doc/FAQs/FAQ/>
>>>>>>>>>>>>> NB: comp.lang.perl.misc is NOT a CGI group <<<<<<<<<<<<<<


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

Date: 31 Jul 1997 16:47:05 GMT
From: Greg Land <gland@ccs.neu.edu>
Subject: keys/values 2 hashes
Message-Id: <5rqfi9$t5p$1@camelot.ccs.neu.edu>

I have a script with two hashes with one hash's keys to be guarenteed
to be in the other hashes key list.  I need to go through the smaller
hash(%owned) and foreach key compare the value to that of the other
hashes(%games) value.  Do to the semi-randomness of the sorage of
key/value pairs, how could you do this?

					Thanks in advance
					       Greg


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

Date: Wed, 30 Jul 1997 15:58:13 GMT
From: mick@picus.dcs.bbk.ac.uk (Mick Farmer)
Subject: Re: Looking for a routine to trim white space  (like VB trim$)
Message-Id: <EE5311.7Ls@mail2.ccs.bbk.ac.uk>

Dear pk,

Try something like this.

	s/^\s*(.*?)\s*$/$1/;

You might have to put back a trailing newline.

Regards,

Mick


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

Date: Wed, 30 Jul 1997 09:49:40 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Jose Ignacio <jigonzalez@readysoft.es>
Subject: Re: open a url
Message-Id: <Pine.GSO.3.96.970730094546.23957N-100000@kelly.teleport.com>

On Tue, 29 Jul 1997, Jose Ignacio wrote:

> I don't know how to open a url for reading. I
> try open (FILE, "http://www.xxxxx.com/gg.htm) but this don't work.

Install LWP, which you can find in this location, in one of the libwww*
files. 

    http://www.perl.com/CPAN/modules/by-module/LWP/

Then you can write something like this.

    use LWP::Simple;
    $file = get "http://www.xxxxx.com/gg.htm";

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/




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

Date: Thu, 31 Jul 1997 15:59:12 +0100
From: Clare Ferry <cferry@cs.strath.ac.uk>
Subject: pattern matching
Message-Id: <33E0A840.5143@cs.strath.ac.uk>

hi
	does anyone know how to match to a scalar variable?

	/$var_name/ doesn't work

	clare


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

Date: Thu, 31 Jul 1997 11:47:38 -0500
From: "Dan Brian" <dan@clockwork.net>
Subject: Re: pattern matching
Message-Id: <5rqfec$l5d@hurricane.jriver.com>

/$var_name/ does work, if you're trying to match the value of $var_name.
What do you mean by a scalar variable? Are you trying to determine the
length of $var_name? Not clear on what you are looking for.

Clare Ferry wrote in article <33E0A840.5143@cs.strath.ac.uk>...

>hi
> does anyone know how to match to a scalar variable?
>
> /$var_name/ doesn't work
>
> clare




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

Date: Tue, 29 Jul 1997 14:01:50 +0100
From: Glenn Rowe <growe@mic.dundee.ac.uk>
Subject: Perl and MS Personal Web Server/Win 95
Message-Id: <33DDEB0C.45CD3399@mic.dundee.ac.uk>

I was wondering if anyone has managed to use Perl5 CGI scripts
on a Personal Web Server (as created by Microsoft Front Page)
on a Windows 95 machine?

I have managed to get Perl CGI scripts running OK on an NT
machine by following Microsoft's on-line documentation (copied
to the Perl FAQ - this involves editing the registry). However,
the FAQ says that the same procedure 'appears to work for
the Personal Web Server on Windows 95'. It doesn't for me,
since the registry on the Win 95 machine doesn't have the
categories referred to in the FAQ.

Thanx.

--
Glenn Rowe, Applied Computer Studies Division
University of Dundee, DUNDEE DD1 4HN U.K.
http://orange.mcs.dundee.ac.uk:8080/Test/home.html
"Technology is dominated by those who manage what they don't
understand."




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

Date: Thu, 31 Jul 1997 03:17:35 GMT
From: over@the.net (dave)
Subject: Re: perl on Win32 - fork()
Message-Id: <33e002b3.3728748@news.one.net>

Eric Foster-Johnson <johnsone@camax.com> wrote:

>Andrew Cheyne wrote:
>> 
>> Hello..
>> 
>>    I am porting a Unix perl script to perl for Win32 and keep
>> getting an error message stating that fork is unspoorted. IS
>> this true? Is it available anywhere else?
>
>Andrew,
>
>Windows does not support the fork() model of process creation.
>You can either use the system() command, or on Windows, use
>Win32::Process::Create().


This DOES sound like VMS.  Creating processes was never an issue.  The
problem was how to get processes to communicate.  VMS answer was
usually an AST and shared memory.  Message passing in VMS sucked.
What's it like in NT?  Are TCP sockets supported in perl for Win32
that can communicate with UNIX programs?


Dave
|
| Please visit me at http://w3.one.net/~dlripber
|
| For reply by email, use:
| dlripber@one.net
|________


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

Date: Thu, 31 Jul 1997 09:10:54 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: Perl Script with Netscape 4.01
Message-Id: <Pine.GSO.3.96.970731085510.20106V-100000@kelly.teleport.com>

On 30 Jul 1997, Randal Schwartz wrote:

> >>>>> "Tom" == Tom Phoenix <rootbeer@teleport.com> writes:
> 
> Tom> Perl neither knows nor cares what version your browser is. In
> Tom> fact, it has no idea that browsers exist. As far as Perl is
> Tom> concerned, it's all just data in and data out.
> 
> How do you know it hasn't developed a mythology around where that data
> must be coming from and going to?  Passed down from the great Perl 0,
> via Perl 1, and Perl 2, on to the current Perl 5.004_01.  Perhaps
> branch cults have developed, thinking that not all of the data must be
> from files and "the user" anymore, but "gasp!" other machines via
> "gasp!" browsers.  Of course, these Perl cults were probably shunned
> by the majority of the centrists and orthodox Perls.

I don't know. I've always thought of Perl as being utilitarian. (Not
Unitarian, mind you, but utilitarian! :-)

On the other hand, maybe Perl has delusions of godhood. After all, with
the right programming it can bless and kill, and even choose when it will
die. But maybe it knows that it's mortal: There's no doubt that it knows
sin().... 

That reminds me. My script needs to be saved. :-)

[ I hope that nobody is offended by what I've written here, but I'll
apologize here in case somebody might be too sensitive to see that this is
merely a joke about linguistic ambiguity, and not intended to be in any
way disrespectful to anyone's sincere spiritual beliefs. ]

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 31 Jul 1997 19:02:47 GMT
From: "Paul" <paul@flinet.com>
Subject: Question ?
Message-Id: <01bc9de3$bb1fed20$581a0ed0@paul.flinet.com>


I have written a perl greeting card program that works great except for 1
minor detail.
When someone from AOL makes a card, for some reason it triggers the program
more than once and duplicate cards are created. The happens rarely with
other providers.
When I see duplicates, 99% of the time its from a AOL user. Does anyone
have an explaination or cure ?



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

Date: 31 Jul 1997 19:08:55 GMT
From: "Paul" <paul@flinet.com>
Subject: Question ???
Message-Id: <01bc9de4$969235c0$581a0ed0@paul.flinet.com>

I have written a perl greeting card program that works great except for 1
minor detail.
When someone from AOL makes a card, for some reason it triggers the program
more than once and duplicate cards are created. The happens rarely with
other providers.
When I see duplicates, 99% of the time its from a AOL user. Does anyone
have an explaination or cure ?

paul@flinet.com


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

Date: Tue, 29 Jul 1997 07:35:00 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Regexp
Message-Id: <k1okr5.us.ln@localhost>

Eike Grote (eike.grote@theo.phy.uni-bayreuth.de) wrote:
: Hi,

: J.Hernetkoski wrote:
: > 
: > How would I change all lines that contains
: > 
: > <a href="/something.html">
: > 
: > to
: > 
: > <a href="http://my.server.com/something.html"> ?


: Try this one:

:    foreach (@results) {
:        s/<A HREF=\"(.*?)\">/<A HREF=\"http:\/\/my.server.com\/$1\">/g;
:    }


Or, if you want to avoid that rampant backslashitis, which will very
likely get in the way of understanding what's going on when you return
to the code after a few weeks, then:


s!<A HREF="(.*?)">!<A HREF="http://my.server.com/$1">!gi;


The double quotes did not need escaping to begin with.

Changing the delimiter from slash to something else removes the 
need to escape slashes...


[ also added s///i to ignore case ]


: A few notes:

[ snip other notes ]

: (4) Using your example above you will get two slashes after the
:     replacement (between 'my.server.com' and 'something.html') - if
:     that matters to you, remove the one after 'com' in the replace part.



--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Thu, 31 Jul 1997 16:39:56 GMT
From: maelstrom@deathsdoor.com.REMOVETHIS (Maelstrom)
Subject: Re: Removing Carriage Returns???
Message-Id: <33e0bf0a.10449956@news.upnaway.com>

cottons@bre.co.uk (Steve Cotton) wrote thus:

>
>In article <5rd5gf$cgo$1@bashir.ici.net>, burt@ici.net (Burt Lewis) writes:
>
>|> I have a script that's reading the input from an HTML form and I can't seem 
>|> to remove ALL of the carriage returns. It may not be just the very last 
>|> character, there could be some anywhere.  Since I'm writing this to a single 
>|> line text file I need to strip them all away. 
>
>A global search & replace on \n is all you need:
>
>$line_of_text =~ s/\n//g;

I'm no expert so don't take my word as law but you may also want to remove
the \r character.  When I was doing something like this I found that a
Windows browser tended to send both characters which caused unpredictable
results.

--Steve
"Oh, please.  How fucking immature can you boys be?
Our army could kick your army's ass."
s2nhshac@titan.vcu.edu


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

Date: 30 Jul 1997 16:59:14 GMT
From: felix@crowfix.com (Felix Morley Finch)
Subject: Re: send mail from perl
Message-Id: <slrn5tusn7.4rl.felix@crowfix.com>

On Wed, 30 Jul 1997 10:24:16 +0300, Murat KASIKCIOGLU <mkasikci@escortnet.com> scrawled:
>Hi,
>
>How can I send e-mail from perl program. ?

Here's some cheap code I use (Linux, CHEAP! :-):

sub SendMail {
    my($sendto, $subject, $body) = @_;
    open(MAIL, "|/usr/bin/sendmail $sendto") || die "Can't send mail";
    print MAIL "To: $sendto
Subject: $subject
From: dbquery

$body";
    close MAIL;
}

Told you it was cheap...


-- 
            ... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
      Felix Finch, scarecrow repairer, rocket surgeon / felix@crowfix.com
            PGP = 91 B3 94 7C E9 E8 76 2D   E1 63 51 AA A0 48 89 2F
I've found a solution to Fermat's Last Theorem but I see I've run out of room o


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

Date: 31 Jul 1997 18:58:45 GMT
From: lynchrl@ucsub.Colorado.EDU (Ryan Lynch)
Subject: Stripping ^M from a variable. How?
Message-Id: <5rqn95$ktq@lace.colorado.edu>

I have a string variable with the following text:

"100 percent AST - Development of the Global Learning and 
Observations to^M Benefit the Environment program in NOAA, 
development of workstations to be^M used in schools,
development of data center."

What I need is to strip the ^M out of there.  I've tried:

$my_string =~ s/\r//g;
$my_string =~ s/\015//g;
$my_string =~ s/\n//g;
$my_string =~ s/\f//g;

but the carriage returns are still there.  Any help would be great.  Thanks!


-Ryan


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

Date: Wed, 30 Jul 1997 17:15:51 GMT
From: mark@usaor.net (Mark Kogon)
Subject: syslog or syslogd
Message-Id: <5ro0c1$l9p@crack.usaor.net>
Keywords: syslog syslogd

Does anyone know how to utilize syslog or syslogd using PERL

I have been unable to generate a working program that effectively uses this 
utility.

Any help would be greatly appreciated.

Thanks,

Mark Kogon


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

Date: Mon, 28 Jul 1997 12:13:17 GMT
From: Steve_Kilbane@cegelecproj.co.uk
Subject: Re: Too many people in this group are arrogant #*(@# (Re: Checking for valid Email...)
Message-Id: <71c7cd$cd11.3c2@news.cegelecproj.co.uk>

In article <01bc9923$ad50f3c0$c50ab2c2@Tschai>, "John Bokma" <jbokma@caiw.nl> writes:
> Questions asked on USENET are not directed to *one* person.

Indeed not. You're not using one person's time, you're using many
people's time.

> If
> you get wound up, just don't answer them.

QED.

> As I stated before, each Perl question can be found by exhaustive
> search
> and reading and examining the Perl sources. So each question asked in
> this or any other group is only a short cut.

True, but it's not the first port of call - or at least, it shouldn't be.

> > USENET is not free consultancy or a magic oracle. 
> 
> Ha Ha Ha!!! Then you don't understand USENET. (Or I don't understand
> it).

You don't. Nor do many, many people. Laziness is wrong, and rife.
So's spam, which doesn't excuse it, either.

> Most people are using USENET for asking questions or reading the
> answers
> (well, some use it to get binary stuff).

Too true, and by all means trawl the groups and the web for existing
solutions. But your first thought shouldn't be, "gee, I don't know, I'll
just ask a few million people the same question that's been asked once
a week for the last three years - I'm sure they all won't mine typing
it all in again, just for little me...".

> People who ask newbie questions can't find the FAQ.

This is a flaw in their education, something the ISPs should be
trying to resolve, but that's a different can o' worms.

> An answer like
> "Read the FAQ" is to them very arrogant.

 ...but not as arrogant as assuming other people will do your
research for you for free, because you're too lazy.
-- 
<Steve_Kilbane@cegelecproj.co.uk> - All opinions are mine alone.
Kilbane's law of integration: standardise on protocols and file
formats, and the applications take care of themselves.



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

Date: 30 Jul 1997 17:18:34 GMT
From: dbh@fc.hp.com (Dave Hollenbeck)
Subject: Re: Unexecuted stmt adds array elem??
Message-Id: <5rnt1a$hr9@fcnews.fc.hp.com>

Dave Hollenbeck (dbh@fc.hp.com) wrote:
: I have some code which produces an array element count even though

Sorry, this didn't need to be nearly as long to demonstrate my
complete lack of understanding referenced arrays.

The answer is, $self->{somearray} is a reference, and must be
dereferenced by @{$self->{somearray}}.

Again, sorry for cluttering.

Dave


: @foo = $a->{somearray};
: $foo = @foo;

: print "Number of elements: $foo\n";


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

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

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