[17444] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4864 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 10 14:05:47 2000

Date: Fri, 10 Nov 2000 11:05:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <973883112-v9-i4864@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 10 Nov 2000     Volume: 9 Number: 4864

Today's topics:
        Are # comments really comments? <dpc3k@virginia.edu>
    Re: Are # comments really comments? <joe+usenet@sunstarsys.com>
    Re: Are # comments really comments? <dpc3k@virginia.edu>
    Re: Are # comments really comments? <joe+usenet@sunstarsys.com>
    Re: changing a string for ODBC use otuzow@my-deja.com
    Re: changing a string for ODBC use <jeff@vpservices.com>
    Re: dbm file formats zfer@my-deja.com
        Deamon newbee alphageekster@my-deja.com
    Re: grep and reg exp question <bart.lateur@skynet.be>
    Re: grep and reg exp question (Helgi Briem)
    Re: grep and reg exp question (Mark-Jason Dominus)
    Re: Handling telnet session termination <bkennedy99@home.com>
    Re: Hash assignments in loops? (Helgi Briem)
    Re: Hash assignments in loops? (Tad McClellan)
    Re: how do I process multiple selections? <james@NOSPAM.demon.co.uk>
    Re: Install mod on Win32 with nmake <randy@theoryx5.uwinnipeg.ca>
    Re: Kerberos 4 <lmpinto@dei.uc.pt>
    Re: Kerberos 4 <joe+usenet@sunstarsys.com>
    Re: make test (bad command or filename) <randy@theoryx5.uwinnipeg.ca>
    Re: my.cgi.suspended <gus@black.hole-in-the.net>
        Need regex tweak to encode XML entities <smig@my-deja.com>
    Re: Need regex tweak to encode XML entities (Tad McClellan)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 10 Nov 2000 11:11:06 -0500
From: "Doug Coppage" <dpc3k@virginia.edu>
Subject: Are # comments really comments?
Message-Id: <8uh6n8$pp7$1@murdoch.acc.Virginia.EDU>

Greetings, All!

According to the literature, "Perl uses # to introduce comments." I am led
to assume that everything to the end-of-line character is ignored. However,
attempting to run a program with commented-out testing statements like this,

#DBUG: print STDERR 'Temp1 = '.$temp1.'  Temp2 is '.$temp2."\n";

often yields "runaway string" errors several lines down. Erasing these
erstwhile comments from my source code eliminates the problem. Also, it
seems that the two characters '<' and '>' cannot be safely used in
commented-out print statements, either.

Any comments?  # I will not ignore them. Honest.

===========================================
Douglas P. Coppage,  dpc3k@virginia.edu
Microcomputer Support Specialist
ITC - Academic Computing for the Health Sciences
University of Virginia, Charlottesville, VA
http://www.med.virginia.edu/achs
===========================================




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

Date: 10 Nov 2000 11:33:28 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Are # comments really comments?
Message-Id: <m3itpv9487.fsf@mumonkan.sunstarsys.com>

"Doug Coppage" <dpc3k@virginia.edu> writes:

> Any comments?  # I will not ignore them. Honest.

Would you be so kind as to post both code + output first?

-- 
Joe Schaefer


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

Date: Fri, 10 Nov 2000 12:00:13 -0500
From: "Doug Coppage" <dpc3k@virginia.edu>
Subject: Re: Are # comments really comments?
Message-Id: <8uh9jb$r4s$1@murdoch.acc.Virginia.EDU>

I will attempt to manufacture such a problem. The source file is long, and
in a fit of "4:50 frustration" I deleted any comment in it that raised a
compilation error.

Please stand by.

---Doug Coppage

"Joe Schaefer" <joe+usenet@sunstarsys.com> wrote in message
news:m3itpv9487.fsf@mumonkan.sunstarsys.com...
> "Doug Coppage" <dpc3k@virginia.edu> writes:
>
> > Any comments?  # I will not ignore them. Honest.
>
> Would you be so kind as to post both code + output first?
>
> --
> Joe Schaefer




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

Date: 10 Nov 2000 12:26:34 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Are # comments really comments?
Message-Id: <m3em0j91rp.fsf@mumonkan.sunstarsys.com>

"Doug Coppage" <dpc3k@virginia.edu> writes:

> I will attempt to manufacture such a problem. The source file is long, and
> in a fit of "4:50 frustration" I deleted any comment in it that raised a
> compilation error.
> 
> Please stand by.
> 

Possible hint: keep an eye out for 

<<

earlier in your code.

-- 
Joe Schaefer


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

Date: Fri, 10 Nov 2000 15:56:03 GMT
From: otuzow@my-deja.com
Subject: Re: changing a string for ODBC use
Message-Id: <8uh5qe$4ad$1@nnrp1.deja.com>

In article <gWPO5.31150$tL4.417875@zonnet-reader-1>,
  "Michel Wouterse" <miriamsmit@zonnet.nl> wrote:
> Hi Group,
>
> I wrote a simple form and script that allows people to put a line of
text in
> a database.
> I am using Perl for the script, windows NT, Access ODBC for the
database.
> Everything goes fine until I use characters like ', ", &, @ and so on
in my
> oneliners...
>
> How do I change those characters into a format accepted? And what
format
> does it want?
>
> please help me,
>
> Michel
>
 Try to change them to corresponding hex codes followed by %.


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


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

Date: Fri, 10 Nov 2000 09:29:39 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: changing a string for ODBC use
Message-Id: <3A0C3083.CAC8A254@vpservices.com>

otuzow@my-deja.com wrote:
> 
> In article <gWPO5.31150$tL4.417875@zonnet-reader-1>,
>   "Michel Wouterse" <miriamsmit@zonnet.nl> wrote:
> >
> > I am using Perl for the script, windows NT, Access ODBC for the
> > database. Everything goes fine until I use characters like ', ", 
> > &, @ and so on in my oneliners...
> >
> > How do I change those characters into a format accepted? And what
> > format does it want?

If you want to know what characters Access or ODBC "want", you need to
look in the documentation or newsgroups about databases.  But it seems
quite unlikely to me that those characters are causing a problem in the
database itself, it is more likely to be something in your perl code. 
If you are using DBI (and if not, why not?) then you may be able to 
avoid the problems with placeholders (see the DBI docs).  OTOH, without
seeing the code that takes the form results, processes them, and inserts
them into the database, it's hard to guess what is going wrong.

-- 
Jeff


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

Date: Fri, 10 Nov 2000 12:06:53 GMT
From: zfer@my-deja.com
Subject: Re: dbm file formats
Message-Id: <8ugocq$p3d$1@nnrp1.deja.com>

In article <8ugis8$l93$1@nnrp1.deja.com>,
  zfer@my-deja.com wrote:
> [...]
> The ISP has upgraded its Linux system.
>
> Today I've discovered that scripts are still working but the old *.db
> files are not readable on new ISP system and the binary compatibility
> from local *.db and remote *.db files is missed.
>
> Are there suggestions about how to solve this incompatibility?
> Are there suggestions about how to translate data stored in old *.db
> format in the new *.db?

Now I've tried to open the ISP *.db format on my local FreeBSD system
using perl "tie" and various 'GDBM_File', 'DB_File', 'NDBM_File',
'SDBM_File' but none of that has opened successfully the target file.

Then I've tried to write some data using the same 'tie' open method
but only using 'GDBM_File' CLASS it succeded.

Old void file.db dimension is 16384 bytes
New void file.db dimension is 12288 bytes
GDBM_File created is 24576 bytes

How can I identify from Perl or any other language
which is the format of a *.db file?


Thank you in advance,            \fer


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


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

Date: Fri, 10 Nov 2000 15:44:54 GMT
From: alphageekster@my-deja.com
Subject: Deamon newbee
Message-Id: <8uh55k$3mj$1@nnrp1.deja.com>

I am starting to get interested in
perl and deamon writing.  I have been
very impressed with the responses to
this discussion page so thought that
I would ask if anyone has some
refrences (on-line preferably (Im cheap))
on the combination or just deamon writing
on an AIX box.

Thanks in advance


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


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

Date: Fri, 10 Nov 2000 11:40:45 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: grep and reg exp question
Message-Id: <elnn0ts701dip9pse59a0fjicj26a54kqr@4ax.com>

Gordon Vrdoljak wrote:

>I have a user form which people fill out on the web.  It searches for their last
>name from seperate text file which includes last name, first name, email, etc. 
>If the search fails it gives them an error that they were not in our database.
>
>open (GREP, "grep -i '$lastname' format.txt|");
>@search_result = <GREP>;

>My problem is that if the person puts in nothing for their lastname, or if they
>put in a single letter, it gives a positive result for the search result.

Not just that. If the last name is "Vrdoljak" and they type in "dol",
this name will be found. If the first name is "Gordon" and they type in
"ord", it will be found. In short: your regex is much too liberal. You
need to anchor it, so that only the correct field will be searched.

And you might just as well try a pure perl solution.

-- 
	Bart.


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

Date: Fri, 10 Nov 2000 12:25:39 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: grep and reg exp question
Message-Id: <3a0be50c.3814328924@news.itn.is>

On Fri, 10 Nov 2000 04:09:13 GMT, tjla@guvfybir.qlaqaf.bet
(Gwyn Judd) wrote:

>I was shocked! How could Gordon Vrdoljak <vrdoljak@uclink.berkeley.edu>
>say such a terrible thing:
>>Hello,
>>thanks for your replies...
>>No, I didn't use taint checks.
>>
>>The format of the text file I am pulling in is:
>>"Elizabeth","Bergen","23763","","201 Wellman","","Resh"
>>"Virginetta","Cannon","36230","","311 LSA","4860788","Keller"
>>"Mark","Carrier","27742","","311A Koshland Hall","8499221","Sussex"
>>etc...
>>
>>It is a comma seperated output of our filemaker database of users with first,
>>lastname, phone, email, address, Lab phone, and supervisor.
>
>In that case I would probably use the DBD::CSV module which is designed
>to split CSV file like this, rather than just using grep(1) which isn't.
>
or alternatively:

open IN, $phonebook or die " Cannot open $phonebook :$!\n";
my $match = 0;
while (<IN>)
{

	my ($first,$last,$phone,$email,$address,$labphone,$super)
= split (/,/,$_);
	if ($last =~ /$lastname/gi) { $match = 1; print "Match
found:$_\n"; }
}
close IN or die "Cannot close $phonebook:$!\n";
if (not $match) { print "No match found\n"; }

Regards, 
Helgi Briem


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

Date: Fri, 10 Nov 2000 18:30:26 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: grep and reg exp question
Message-Id: <3a0c3ec1.2522$270@news.op.net>

In article <3A0B3F93.F6944E10@uclink.berkeley.edu>,
Gordon Vrdoljak  <vrdoljak@uclink.berkeley.edu> wrote:
>open (GREP, "grep -i '$lastname' format.txt|");
>@search_result = <GREP>;
>close (GREP);
>$search_result=@search_result;
>if ($search_result < 1)
>        {
>        $url = "http://localhost/error-notuser.html";
>        print "Location: $url\n\n";
>        exit;
>        }         

If youre 'grep' command supports the \b symbol, you can use that.  To
find out, run this command:

        echo 'helloXXX' | grep '\bhello\b'

If grep supports \b, then you will get *no* output.  If you get the
output 'XXXhelloXXX' or an error message, 

If grep does support \b, then just use this:

        open (GREP, "grep -i '\\b$lastname\\b' format.txt|");

If not, you need to use Perl to do the matching, because grep does not
do what you want.  Try something like this:

        open FORMAT, "< format.txt" or die ...;
        while (<FORMAT>) {
          push @search_result, $_ 
            if /\b$lastname\b/;
        }
        close FORMAT;
        # the rest as above

-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Fri, 10 Nov 2000 16:49:45 GMT
From: "Ben Kennedy" <bkennedy99@home.com>
Subject: Re: Handling telnet session termination
Message-Id: <JGVO5.104962$td5.15591136@news1.rdc2.pa.home.com>


"malgosia askanas" <askanas@panix.com> wrote in message
news:8ubu15$dic$1@panix6.panix.com...
> I have an interactive Perl program which has the following bug: if the
telnet
> session goes down while the user is running the program, the program
continues
> to run and consumes a large amount of system resources.  I tried to put in
> signal handlers for "HUP" and "INT", but that didn't help.  Can anybody
> advise me on how to fix this?  Many thanks in advance.

Are you doing something that blocks on STDIN?  Are the signal handles
getting fired at all?  One way of getting around this may be to ues the
standard utility 'screen', which creates virtual terminals for foreground
process that keep running even if the connection is broken.  The terminals
don't know/care that the interactive user has dropped.

--Ben Kennedy




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

Date: Fri, 10 Nov 2000 12:01:46 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: Hash assignments in loops?
Message-Id: <3a0be24a.3813623700@news.itn.is>

On Fri, 10 Nov 2000 02:22:28 GMT, gelshocker@my-deja.com
wrote:

>Sorry if I didn't make myself more clear beforehand. Still don't quite
>understand how to write the code as a forloop, to loop through a file
>and assign hash pairs during the loop.
>
>i.e. file contents:
>
>apple,john
>lemon,paul
>orange,adam
>
>...and to assign (fruit => person) during the loop.
>

Here's a simple way that's fairly readable and 
doesn't use a map:

my %fruit_preference;
for (@file_contents)
{
	my ($fruit,$person) split/,/,$_;
	$fruit_preference{$person} = $fruit;
}

Regards,
Helgi Briem


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

Date: Fri, 10 Nov 2000 07:35:40 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Hash assignments in loops?
Message-Id: <slrn90nqss.ehp.tadmc@magna.metronet.com>

On Fri, 10 Nov 2000 06:41:22 GMT, gelshocker@my-deja.com 
   <gelshocker@my-deja.com> wrote:


>it won't compile for some reason.
                      ^^^^^^^^^^^

Err, perl will give a reason when it fails to compile.

What did it say?


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


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

Date: Fri, 10 Nov 2000 13:03:33 +0000
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: how do I process multiple selections?
Message-Id: <ant1013330b0fNdQ@oakseed.demon.co.uk>

In article <FuQO5.475$SI1.2702@news6-win.server.ntlworld.com>,
Alan Dougall (ntl) <URL:mailto:abaltd@ntlworld.com> wrote:
>
> Thanks, James - not quite ready to "use strict" - but I'll get there...
> Presumably (when the code is cleaned up) I just put:
> use strict;
> in the script, or have I missed something?

use strict is good for stopping you from accidently using certain
"features" of Perl which can cause hard to track down errors. In other
words in forces a safe style of programming. It would be hard work to
retro-fit it to code that was written with no concern for this safe
programming style. Maybe if you get time you could rewrite the code
under the safety blanket of use strict.

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



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

Date: 10 Nov 2000 14:01:38 GMT
From: Randy Kobes <randy@theoryx5.uwinnipeg.ca>
Subject: Re: Install mod on Win32 with nmake
Message-Id: <8ugv42$imi$1@canopus.cc.umanitoba.ca>

In comp.lang.perl.misc, ccj <mediamas@labyrinth.net.au> wrote:
> I'm trying to install a module in win32 but get this message
> D:\temp>nmake xmltodbms.pm
> xmltodbms.pm(27) : fatal error U1035 : syntax error : expected ':' or'='
> separator
> Stop.

You 'nmake' a file typically called 'Makefile'; the common 
procedure for building a module is
    perl Makefile.PL
    nmake
    nmake test
    nmake install
The 'perl Makefile.PL' line constructs the 'Makefile' which the
next 3 lines use.

best regards,
randy kobes


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

Date: Fri, 10 Nov 2000 13:59:54 -0100
From: "Luis M. Pinto" <lmpinto@dei.uc.pt>
Subject: Re: Kerberos 4
Message-Id: <3A0C0D6A.BAF318CB@dei.uc.pt>

Joe Schaefer wrote:
> 
> "Luis M. Pinto" <lmpinto@dei.uc.pt> writes:
> >
> > Anyway, i would like to get some other examples of working with kerberos
> > inside perl (I want to do something that looks simple - authenticate a
> > user from a web interface, in a http server that doesnt belong to the
> > realm - is that a problem?)
> >
> 
> Are you sure you want to do this? There's really little point in using
> kerberos if you're going to authenticate users by having them transmit
> their passwords to your server in plaintext. You might wind up defeating
> the whole point of using something like kerberos.

	No. I am using mod_ssl to encript the connection between the browser
and the server. And I would like to authenticate users with kerberos,
because i have a realm. The only problem is that the web server does not
belong in the realm, and I dont want it to. But if it is the only way... 
> 
> IIRC, there is a kerberos4 module for apache, but this is OT for
> c.l.p.m.  You might try asking in c.i.w.s.unix to learn more about
> it; better yet search for it at
> 
> http://www.apache.org

	Thanks, but I would like first to try with the perl module... 

> --
> Joe Schaefer

	Luis Pinto


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

Date: 10 Nov 2000 09:18:52 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Kerberos 4
Message-Id: <m3n1f79agj.fsf@mumonkan.sunstarsys.com>

"Luis M. Pinto" <lmpinto@dei.uc.pt> writes:

> Joe Schaefer wrote:
> >
> > Are you sure you want to do this? There's really little point in using
> > kerberos if you're going to authenticate users by having them transmit
> > their passwords to your server in plaintext. You might wind up defeating
> > the whole point of using something like kerberos.
> 
> 	No. I am using mod_ssl to encript the connection between the browser
> and the server. 

Very good!  Last question- do the browsers on the client speak 
kerberos, or are you going to authenticate them remotely via 
transmitted username/password.

> 	Thanks, but I would like first to try with the perl module... 

Sorry I can't help here, but if you answer the above question, perhaps
someone here or in c.l.p.modules might be able to help you.

Best wishes.
-- 
Joe Schaefer


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

Date: 10 Nov 2000 14:11:49 GMT
From: Randy Kobes <randy@theoryx5.uwinnipeg.ca>
Subject: Re: make test (bad command or filename)
Message-Id: <8ugvn5$imi$2@canopus.cc.umanitoba.ca>

In comp.lang.perl.misc, EM <me@privacy.net> wrote:
> in every module i download it says i need to do this

>  1. perl Makefile.PL
>  2. make
>  3. make test
>  4. make install

> step 1 works all others fail with error "bad command or filename"
> i know it means the file doesnt exist but where can i get it?
> i am using activeperl on windows me

Since you're using Win32 ActivePerl, it's easiest to get the make
program 'nmake' (Unix-style make programs won't work); grab 
the self-extracting archive
   ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe
and put the extracted nmake.exe and nmake.err somewhere on
your PATH. Then use the procedure
    perl Makefile.PL
    nmake
    nmake test
    nmake install
For modules that need a C compiler, you'll need Visual C++
for compatability with ActivePerl. However, you should first
check the Perl Package Manager (ppm) utility on ActivePerl
(html documentation comes with the installation); this enables
you to install pre-compiled binaries of many popular modules.

best regards,
randy kobes


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

Date: Fri, 10 Nov 2000 15:47:19 GMT
From: Gus <gus@black.hole-in-the.net>
Subject: Re: my.cgi.suspended
Message-Id: <973871239.28083.0.nnrp-08.c29f015a@news.demon.co.uk>

xzhang3388@my-deja.com wrote:

> What could be the cause and how to prevent this?

Sounds like the administrator of the box has some defense scripts in place
which are doing it. Best bet is to speak to him/her about it.



-- 
gus@black.hole-in-the.net
0x58E18C6D
82 AA 4D 7F D8 45 58 05  6D 1B 1A 72 1E DB 31 B5
http://black.hole-in-the.net/gus/


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

Date: Fri, 10 Nov 2000 15:48:05 GMT
From: smig <smig@my-deja.com>
Subject: Need regex tweak to encode XML entities
Message-Id: <8uh5bi$41g$1@nnrp1.deja.com>

I'm trying to fix some middleware that loads an Oracle table with
contents of an XML file.  It seems like the middleware properly extracts
and passes content containing encoded XML Entities for the '"<> chars
but does not encode the & character.  This is causing grief on the
backend so I'm trying to come up with a regex to find the unencoded
ampersand in a sea of text filled with encoded chars and replace it with
it's encoded value before sending it to Oracle.

Given the following:

  unencoded string:
  <img="joe's&fred's.jpg">

  incompletely encoded (unencoded "&"):
  &lt;img=&quot;joe&apos;s&fred&apos;s.jpg&quot;&gt;

  desired result (encode the & between joe's and fred's):
  &lt;img=&quot;joe&apos;s&apos;fred&apos;s.jpg&quot;&gt;

  using search expression:
  &[^quot;]|&[^apos;]|&[^lt;]|&[^gt;]

  finds:
  "&fred" not just the unencoded "&" char

  so replacing with encoded "&" with this expression:
  \&amp;

  results in "&fred" replaced with "&amp" when I want "&amp;fred"


Can anyone advise how to tweak either the search or replacement
expression so I can get my desired result?  I haven't been able to find
an example, as yet, of use of ^ to position ater the & in the search
result so I could put "amp;" between the "&" and "fred" -- would that do
the trick?

Thanks in advance...

Gene Smilgiewicz



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


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

Date: Fri, 10 Nov 2000 11:29:20 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Need regex tweak to encode XML entities
Message-Id: <slrn90o8j0.f8u.tadmc@magna.metronet.com>

On Fri, 10 Nov 2000 15:48:05 GMT, smig <smig@my-deja.com> wrote:
>I'm trying to fix some middleware that loads an Oracle table with
>contents of an XML file.  It seems like the middleware properly extracts
>and passes content containing encoded XML Entities for the '"<> chars
>but does not encode the & character.  This is causing grief on the
>backend so I'm trying to come up with a regex to find the unencoded
>ampersand in a sea of text filled with encoded chars and replace it with
>it's encoded value before sending it to Oracle.

>  incompletely encoded (unencoded "&"):
>  &lt;img=&quot;joe&apos;s&fred&apos;s.jpg&quot;&gt;
>
>  desired result (encode the & between joe's and fred's):
>  &lt;img=&quot;joe&apos;s&apos;fred&apos;s.jpg&quot;&gt;
                            ^^^^

Surely you meant 'amp' there, not 'apos' ?


>  using search expression:
>  &[^quot;]|&[^apos;]|&[^lt;]|&[^gt;]


I doubt that that "search expression" works very well.

[square brackets] are a character class (not what you want).

(parenthesis) are for grouping (which is what you want).


>Can anyone advise how to tweak either the search or replacement
>expression so I can get my desired result?  I haven't been able to find
>an example, as yet, of use of ^ to position ater the & in the search
>result so I could put "amp;" between the "&" and "fred" -- would that do
>the trick?


^ is not the right thing at all.

You want a negative look-ahead assertion:   (?! regex )

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

$_ = q/&lt;img=&quot;joe&apos;s&fred&apos;s.jpg&quot;&gt;/;
print "before '$_'\n";

s/&(?!lt;|gt;|apos;|quot;)/&amp;/g;
print "after  '$_'\n";
 ------------------------------

output:

before '&lt;img=&quot;joe&apos;s&fred&apos;s.jpg&quot;&gt;'
after  '&lt;img=&quot;joe&apos;s&amp;fred&apos;s.jpg&quot;&gt;'


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


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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

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

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


------------------------------
End of Perl-Users Digest V9 Issue 4864
**************************************


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