[23131] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5352 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 13 11:05:39 2003

Date: Wed, 13 Aug 2003 08:05:08 -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           Wed, 13 Aug 2003     Volume: 10 Number: 5352

Today's topics:
    Re: [RESOLVED] pack V length changes <sjackman@nospam.pathwayconnect.com>
        Bundle::CPAN install problem ? <someone@microsoft.com>
    Re: Can't see http_referrer in IE <flavell@mail.cern.ch>
    Re: Data::Dumper How to quote keys while dumping <usenet@dwall.fastmail.fm>
        File transfer by TCP/IP (Sa Ratone)
    Re: File transfer by TCP/IP <abigail@abigail.nl>
    Re: Gnuplot module (Ingo Fellner)
        Help : from file system structure to topic maps format <vtec.bc@netcourrier.com>
        Help : from file system structure to topic maps format <vtec.bc@netcourrier.com>
        Help : from file system structure to topic maps format <vtec.bc@netcourrier.com>
    Re: Help : from file system structure to topic maps for (Tad McClellan)
    Re: Help : from file system structure to topic maps for <noreply@gunnar.cc>
        how big can a scalar get? <ixanthi@ixanthi.remove.gr>
    Re: how big can a scalar get? <derek@NOSPAMhiredgoons.org>
    Re: how big can a scalar get? <abigail@abigail.nl>
    Re: MLDBM <simonis@myself.com>
    Re: perl + mysql + apache on windows (raja babu)
        Perl scripts interconnectivity... Is it possible... <roman@sky.lviv.ua>
    Re: Perl scripts interconnectivity... Is it possible... <NOSPAM@bigpond.com>
    Re: Problem with join and unicode <flavell@mail.cern.ch>
    Re: Problem with join and unicode <abuseonly@sgrail.org>
    Re: replace space only within quotes with something els (Tad McClellan)
    Re: replace space only within quotes with something els <nospam@please.com>
    Re: Replacing identical lines in a RE <abigail@abigail.nl>
    Re: substitute three random words in a string <abigail@abigail.nl>
    Re: using Getopt::Long with option value having spaces <tony_curtis32@yahoo.com>
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 13 Aug 2003 14:01:53 GMT
From: Shaun Jackman <sjackman@nospam.pathwayconnect.com>
Subject: Re: [RESOLVED] pack V length changes
Message-Id: <lxr_a.3634$zE1.689@edtnps84>

Thanks!

> Yes.
> 
>     perldoc -f binmode
>
>> Where did the extra 7 characters come from? I'm very confused. Why does
>> the length of the $header report 100, but 107 characters get printed? Do
>> I have to set STDOUT to a binary stream somehow?



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

Date: Wed, 13 Aug 2003 08:11:26 -0500
From: "John Smith" <someone@microsoft.com>
Subject: Bundle::CPAN install problem ?
Message-Id: <3f3a3842$0$29085$a32e20b9@news.nntpservers.com>

Hi all,

I'm updating Bundle::CPAN on a Perl 5.8 system (HP UX 11) with this command:
/usr/local/bin/perl -e 'use CPAN; install Bundle::CPAN'

Everything seems to go OK, yet at the end there is always this error
message:
Bundle summary: The following items in bundle Bundle::CPAN had installation
problems:
  Compress::Zlib Archive::Tar

Which seems like a perfectly clear message, except look at the output while
Bundle::CPAN attempted to install Archive::Tar and Compress::Zlib:
<snip>
All tests successful.
Files=2, Tests=71,  2 wallclock secs ( 1.25 cusr +  0.20 csys =  1.45 CPU)
  /usr/bin/make test -- OK
Running make install
Writing
/usr/local/lib/perl5/site_perl/5.8.0/PA-RISC2.0/auto/Archive/Tar/.packlist
Appending installation info to
/usr/local/lib/perl5/5.8.0/PA-RISC2.0/perllocal.pod
  /usr/bin/make install  -- OK

 ...and for Compress::Zlib...
<snip>
All tests successful.
Files=6, Tests=295,  5 wallclock secs ( 3.94 cusr +  0.46 csys =  4.40 CPU)
  /usr/bin/make test -- OK
Running make install
Installing
/usr/local/lib/perl5/site_perl/5.8.0/PA-RISC2.0/auto/Compress/Zlib/Zlib.sl
Files found in blib/arch: installing files in blib/lib into architecture
dependent library tree
Writing
/usr/local/lib/perl5/site_perl/5.8.0/PA-RISC2.0/auto/Compress/Zlib/.packlist
Appending installation info to
/usr/local/lib/perl5/5.8.0/PA-RISC2.0/perllocal.pod
  /usr/bin/make install  -- OK

So why does Bundle::CPAN think it had problems?  Also, I've installed each
of the 'trouble' packages on their own, and they also install seemingly
without error:
/usr/local/bin/perl -e 'use CPAN; install Archive::Tar'
/usr/local/bin/perl -e 'use CPAN; install Compress::Zlib'

Perl 5.6 is also installed on this system.  But when I install modules to
Perl 5.8, I am careful to always specify '/usr/local/bin/perl' which is the
5.8 version.  Could that be causing a problem anyway?  Also, I wrote a tiny
script that uses each of the modules:
#!/usr/local/bin/perl -w
use Archive::Tar;
use Compress::Zlib;

my $x = 'hello world';
print "x is $x\n";

I don't get any errors about not being able to find/use either module when I
run the script.

Any ideas?  Is there even really something wrong?

Thanks in advance,
Ted




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

Date: Wed, 13 Aug 2003 12:08:25 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Can't see http_referrer in IE
Message-Id: <Pine.LNX.4.53.0308131159100.755@lxplus081.cern.ch>

On Wed, Aug 13, pkent offtopically opined:

> It probably depends on your web server software

This appears to have been a stealth CGI question.  Why should it
depend?

> but on my Apache setup the environment variable is called
> 'HTTP_REFERER'.

There is a CGI interworking specification.  The whole _point_ of the
CGI is that it's portable.  If it wasn't portable, then we'd be much
better off using server-specific APIs.

> Note the case and the spellling.

Note the case and the miss pelling, indeed ;-)

It's a mystery to me why the O.P supposed there to be a difference
between Mozilla and IE on this.  But that would be a matter to raise
on comp.infosystems.www.authoring.cgi (if it's indeed a CGI question)
or maybe somewhere else if it was an Apache API question: at any rate
it's not a Perl-specific programming question.

> Also, don't forget that the referrer can easily be faked if someone
> particularly wanted to get one of your pages directly.

Indeed: the thread had already dealt with that and I think the O.P
understands that it's no way to solve their problem, if security is a
real concern.

cheers


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

Date: Wed, 13 Aug 2003 13:32:16 -0000
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: Data::Dumper How to quote keys while dumping
Message-Id: <Xns93D661067ADADdkwwashere@216.168.3.30>

Eric J. Roode <REMOVEsdnCAPS@comcast.net> wrote:

> "David K. Wall" <usenet@dwall.fastmail.fm> wrote in 
> news:Xns93D570BA9DA5Cdkwwashere@216.168.3.30:
> 
>> kamal <kamal@india.ti.com> wrote:
>> 
>>> print STDOUT Data::Dumper->Dump([\%tmp], ['*tmp']);
>> 
>> Quoting is the default.  Don't give Dump() names if that's not
>> what you want.
>> 
>>     print STDOUT Data::Dumper->Dump([\%tmp]);
>> 
>> I'm lazy, so I'd write this as
>> 
>>     print Dumper \%tmp;
> 
> Passing a second argument to Dump has nothing to do with quoting,
> unless I'm mistaken...right?  Your two shortcuts would produce a
> string that began with
> 
>     $VAR1 = {....
> 
> rather than
> 
>     %tmp = (....
> 
> as the OP wanted.

Yup, you're right.  Sometimes I wonder why I even test code before I 
post....


-- 
David Wall


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

Date: 13 Aug 2003 04:45:54 -0700
From: sa_raavanan@yahoo.com (Sa Ratone)
Subject: File transfer by TCP/IP
Message-Id: <7614a862.0308130345.c479790@posting.google.com>

Hi,
Can anyone tell me is it possible to transfer files from one system to
another system to a particular folder by IP address alone? And if
possible, how?
I am not sure how to use Socket.pm or Net.pm. Can anyone help me out.
Thanks in advance.


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

Date: 13 Aug 2003 13:01:47 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: File transfer by TCP/IP
Message-Id: <slrnbjkdlr.v2p.abigail@alexandra.abigail.nl>

Sa Ratone (sa_raavanan@yahoo.com) wrote on MMMDCXXXIV September MCMXCIII
in <URL:news:7614a862.0308130345.c479790@posting.google.com>:
}}  Hi,
}}  Can anyone tell me is it possible to transfer files from one system to
}}  another system to a particular folder by IP address alone? And if
}}  possible, how?

No Perl required.

    $ ncftpput "host" "remote-directory" "local-files..."


Abigail
-- 
$"=$,;*{;qq{@{[(A..Z)[qq[0020191411140003]=~m[..]g]]}}}=*_=sub{print/::(.*)/};
$\=$/;q<Just another Perl Hacker>->();


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

Date: 13 Aug 2003 07:46:10 -0700
From: i.fellner@puz.de (Ingo Fellner)
Subject: Re: Gnuplot module
Message-Id: <89e91023.0308130646.4a1086ad@posting.google.com>

Slaven Rezic <slaven@rezic.de> wrote in message news:<87ispm1ma0.fsf@vran.herceg.de>...
> yuchung@mail.com (Yuchung Cheng) writes:
> 
> > alythh@netscape.net (Alythh) wrote in message news:<6a25ba72.0307230050.57da7475@posting.google.com>...
> > > I just installed  Chart::Graph::Gnuplot, and I'm fairly satisfied.
> > > But...
> > > 
> > > My wish is to be able to make a  gnuplot() call, make it display the
> > > graph, and stay there while other data becomes available... while
> > > replotting the updated data.
> > > 
> > > Is there a way to communicate between the two processes in this way?
> > > Or is this module just to output to a file?
> > > 
> > AFAIK, gnuplot only parse static data and generate the graph, even with
> > "gnuplot -persist" command. The simplist way to do above is to call 
> > gnuplot every once while and re-plot to the same file. 
> 
> No, it's perfectly possible to open a communication channel via
> IO::Pipe and to send multiple commands to gnuplot. Example code on
> demand.
> 
> Regards,
> 	Slaven

DEMAND --> please post example in this newsgroup!!

RGDS

Ingo ;-))


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

Date: Wed, 13 Aug 2003 14:36:56 +0200
From: "test" <vtec.bc@netcourrier.com>
Subject: Help : from file system structure to topic maps format
Message-Id: <bhdbda$qqr$1@news-reader2.wanadoo.fr>

Hello,



I want to make a little script in perl .
 ... but I'm very newbie in this langage



For each sub-directory of a given directory ...

            (and for each file in the directory)

 ... I want to write in a file something like that :




<  <topic>
          <baseName>
                <baseNameString>nameOfTheSubDirectory</baseNameString>
            </baseName>
           <occurrence>
                    <resourceRef
xlink:href="file:///fullNameOfTheFirstFileInTheSubDirectory"/>
            </occurrence>
              <occurrence>
                        <resourceRef
xlink:href="file:///fullNameOfTheSecondInTheSubDirectory"/>
            </occurrence>
  ...
                <occurrence>
                    < resourceRef
xlink:href="fille:///nameOfTheLastFileInTheSubDirectory"/ >
            </occurrence>
  </topic>



(Where fullNameOfEachFile is the name of the file with his path)



Any idea to help me to start ?



Regards



Bernard





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

Date: Wed, 13 Aug 2003 14:38:38 +0200
From: "test" <vtec.bc@netcourrier.com>
Subject: Help : from file system structure to topic maps format
Message-Id: <bhdbgg$21n$1@news-reader3.wanadoo.fr>

Hello,



I want to make a little script in perl .
 ... but I'm very newbie in this langage



For each sub-directory of a given directory ...

            (and for each file in the directory)

 ... I want to write in a file something like that :




<  <topic>
          <baseName>
                <baseNameString>nameOfTheSubDirectory</baseNameString>
            </baseName>
           <occurrence>
                    <resourceRef
xlink:href="file:///fullNameOfTheFirstFileInTheSubDirectory"/>
            </occurrence>
              <occurrence>
                        <resourceRef
xlink:href="file:///fullNameOfTheSecondInTheSubDirectory"/>
            </occurrence>
  ...
                <occurrence>
                    < resourceRef
xlink:href="fille:///nameOfTheLastFileInTheSubDirectory"/ >
            </occurrence>
  </topic>



(Where fullNameOfEachFile is the name of the file with his path)



Any idea to help me to start ?



Regards



Bernard






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

Date: Wed, 13 Aug 2003 16:06:26 +0200
From: "bernard" <vtec.bc@netcourrier.com>
Subject: Help : from file system structure to topic maps format
Message-Id: <bhdgl3$dfi$1@news-reader2.wanadoo.fr>

Hello,


I want to make a little script in perl .
 ... but I'm very newbie in this langage


For each sub-directory of a given directory ...
            (and for each file in the directory)
 ... I want to write in a file something like that :


<topic>
       <baseName>
            <baseNameString>nameOfTheSubDirectory</baseNameString>
       </baseName>
       <occurrence>
            <resourceRef
xlink:href="file:///fullNameOfTheFirstFileInTheSubDirectory"/>
        </occurrence>
        <occurrence>
                <resourceRef
xlink:href="file:///fullNameOfTheSecondInTheSubDirectory"/>
         </occurrence>
   ...
          <occurrence>
                < resourceRef
xlink:href="fille:///nameOfTheLastFileInTheSubDirectory"/ >
           </occurrence>
  </topic>


(Where fullNameOfEachFile is the name of the file with his path)


Any idea to help me to start ?

Regards

Bernard




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

Date: Wed, 13 Aug 2003 08:12:39 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Help : from file system structure to topic maps format
Message-Id: <slrnbjkea7.3jt.tadmc@magna.augustmail.com>

test <vtec.bc@netcourrier.com> wrote:

> For each sub-directory of a given directory ...

> Any idea to help me to start ?


   use File::Find;


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


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

Date: Wed, 13 Aug 2003 16:31:04 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Help : from file system structure to topic maps format
Message-Id: <bhdi33$10tkp7$1@ID-184292.news.uni-berlin.de>

bernard wrote:
> I want to make a little script in perl .
> ... but I'm very newbie in this langage

You are obviously a newbie in posting to Usenet as well.

Please study the posting guidelines for the groups you are posting to. 
For clpmisc you find them at 
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html

Do not multipost!

As regards learning Perl, try this link: http://learn.perl.org/

Post to Usenet only when you have found out what's the proper way.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Wed, 13 Aug 2003 14:19:15 +0300
From: "Vassilis Tavoultsidis" <ixanthi@ixanthi.remove.gr>
Subject: how big can a scalar get?
Message-Id: <bhd6rj$n0$1@nic.grnet.gr>

What happens if I make a simple scalar variable big? What memory problems it
can give me and what is the limit?

e.g.

$t = "";
$maxlen = 100000;
while (length($t) < $maxlen)
{
    $t = $t.$i."|";
};




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

Date: Wed, 13 Aug 2003 22:02:44 +1000
From: Derek Thomson <derek@NOSPAMhiredgoons.org>
Subject: Re: how big can a scalar get?
Message-Id: <3f3a290e$1@duster.adelaide.on.net>

Vassilis Tavoultsidis wrote:
> What happens if I make a simple scalar variable big? What memory problems it
> can give me and what is the limit?
> 

It can be as big as you like. You are only limited by the size of your 
computer's memory.

Derek.

[Remove NOSPAM to reply directly]



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

Date: 13 Aug 2003 13:05:28 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: how big can a scalar get?
Message-Id: <slrnbjkdso.v2p.abigail@alexandra.abigail.nl>

Vassilis Tavoultsidis (ixanthi@ixanthi.remove.gr) wrote on MMMDCXXXIV
September MCMXCIII in <URL:news:bhd6rj$n0$1@nic.grnet.gr>:
~~  What happens if I make a simple scalar variable big? What memory problems it
~~  can give me and what is the limit?


Perl is willing to consume as much memory as your system is able
to give. That's on limit. The other limit is the size of your
pointers. If you have 32 bit pointers, the OS might be willing to
give you 10 Gb of memory, but you can only address 2 Gb of it.

However, Perl can be build with 64 bit pointers. If that's not
enough for the amount of memory yous OS is willing to give you,
I want to see your system.



Abigail
-- 
package Z;use overload'""'=>sub{$b++?Hacker:Another};
sub TIESCALAR{bless\my$y=>Z}sub FETCH{$a++?Perl:Just}
$,=$";my$x=tie+my$y=>Z;print$y,$x,$y,$x,"\n";#Abigail


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

Date: Wed, 13 Aug 2003 14:31:06 GMT
From: simonis <simonis@myself.com>
Subject: Re: MLDBM
Message-Id: <3F3A4B94.FF4B6D86@myself.com>

Jeff Mott wrote:
> 
> simonis <simonis@myself.com> wrote in message news:<3F390EF7.63A954C5@myself.com>...
> > Jeff Mott wrote:
> > >
> > > Is there a wrapper to perform encryption on an MLDBM database? Since
> > > file permissions is a Unix-only feature, I'd prefer not to rely on
> > > that. Data encryption would appear to be the only cross platform way
> > > to keep the data secure. Unless someone has any better ideas...?
> >
> > Not sure how this is related to Perl.
> 
> errr....why are so many people so !@#$ %^&* about this kind of
> thing?!?
> 
> There is an MLDBM module __FOR PERL__. I am importing this module into
> my program, written __IN PERL__. I want this data secure without being
> dependant on any particular OS. So I need a sub class of MLDBM (that
> would be another __PERL MODULE__) that, using an encryption
> implemention __WRITTEN FOR PERL__, encrypts/decrypts all data
> stored/retrieved.
> 
> Are you seeing how this relates to Perl yet?

No.


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

Date: 13 Aug 2003 05:54:26 -0700
From: raja_babu0@lycos.com (raja babu)
Subject: Re: perl + mysql + apache on windows
Message-Id: <67505fb2.0308130454.52dfd55c@posting.google.com>

well, I login to the machine as Administrator. The Apache config file
( httpd.conf ) has no mention of any user under which it is running -
so it could be running under the Admnistrator account. When I do it
from the command line I am running as Administrator. I do not know who
has permissions on the named pipe - how do I find out?

rb

ctcgag@hotmail.com wrote in message news:<20030812170712.414$aG@newsreader.com>...

> Pardon if this question doesn't make sense on Windows, but who is apache
> running as?  Who are you running as when you do it from the command
> line?  Who has permissions on the named pipe?
> 
> Xho


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

Date: Wed, 13 Aug 2003 13:08:51 +0300
From: "Roman Khutkyy" <roman@sky.lviv.ua>
Subject: Perl scripts interconnectivity... Is it possible...
Message-Id: <bhd2oe$1rqe$1@news.uar.net>

Is there any way for Perl script to use subroutines from another one?

Thanks.




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

Date: Wed, 13 Aug 2003 20:28:29 +1000
From: "Gregory Toomey" <NOSPAM@bigpond.com>
Subject: Re: Perl scripts interconnectivity... Is it possible...
Message-Id: <bhd3si$10vokg$1@ID-202028.news.uni-berlin.de>

"Roman Khutkyy" <roman@sky.lviv.ua> wrote in message
news:bhd2oe$1rqe$1@news.uar.net...
> Is there any way for Perl script to use subroutines from another one?
>
> Thanks.

RTFM
http://www.perldoc.com/perl5.8.0/pod/func/use.html

gtoomey




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

Date: Wed, 13 Aug 2003 11:56:07 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Problem with join and unicode
Message-Id: <Pine.LNX.4.53.0308131132290.755@lxplus081.cern.ch>

On Wed, Aug 13, derek / nul inscribed on the eternal scroll:

> I have a problem with the join command inserting and extra \n on the end of
> every line.

"extra" to what?

> I don't seen to be able to get rid of them.

Presumably it's you who's putting them there.

> @linesengwag1 is a list of lines of a parameters for M$ Train Sim

But where did you get them from?  Your snippet doesn't show that.
Maybe those lines already end with a newline, and you're adding
another one with join() ?  You aren't really showing us enough of your
working to be sure.

> I am 'join'ing the list so that I can encode it back to unicode.

(Since you're working with 5.8.0, it seems to me that you're liable to
cause yourself additional problems by trying to work in binary (i.e
bytes mode).  I'd recommend working in Perl's native unicode
representation (:utf8, i.e character mode) and using I/O layers to
convert to/from the utf-16LE that you apparently need externally.)

> I am trying to use s/// to get rid of the extra \n's

I'd look to not causing the damage in the first place, rather than
trying to repair the damage afterwards.

> but the program gives no
> warnings but stops after the first line (ie where the first \n is).

Isn't that normal for s/// without the appropriate option flag? See
perlop or the usual Perl tutorial materials.

< http://www.perldoc.com/perl5.8.0/pod/perlfaq6.html
#I'm-having-trouble-matching-over-more-than-one-line.--What's-wrong- >

But you're concentrating on the wrong problem at that point, IMHO.




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

Date: Wed, 13 Aug 2003 11:39:48 GMT
From: derek / nul <abuseonly@sgrail.org>
Subject: Re: Problem with join and unicode
Message-Id: <d55kjvo35lv3gvvrp6g12olmna4cngiq0q@4ax.com>

On Wed, 13 Aug 2003 11:56:07 +0200, "Alan J. Flavell" <flavell@mail.cern.ch>
wrote:

>On Wed, Aug 13, derek / nul inscribed on the eternal scroll:
>
>> I have a problem with the join command inserting and extra \n on the end of
>> every line.
>
>"extra" to what?

extra to the \r\n's that are already there

>> I don't seen to be able to get rid of them.
>
>Presumably it's you who's putting them there.

it would appear so

>> @linesengwag1 is a list of lines of a parameters for M$ Train Sim
>
>But where did you get them from?  Your snippet doesn't show that.
>Maybe those lines already end with a newline, and you're adding
>another one with join() ?  You aren't really showing us enough of your
>working to be sure.

The list does indeed have \r\n's in it before the join

>> I am 'join'ing the list so that I can encode it back to unicode.
>
>(Since you're working with 5.8.0, it seems to me that you're liable to
>cause yourself additional problems by trying to work in binary (i.e
>bytes mode).  I'd recommend working in Perl's native unicode
>representation (:utf8, i.e character mode) and using I/O layers to
>convert to/from the utf-16LE that you apparently need externally.)

pointers please

>> I am trying to use s/// to get rid of the extra \n's
>
>I'd look to not causing the damage in the first place, rather than
>trying to repair the damage afterwards.

I have tried that but only cause more errors

>> but the program gives no
>> warnings but stops after the first line (ie where the first \n is).
>
>Isn't that normal for s/// without the appropriate option flag? See
>perlop or the usual Perl tutorial materials.

looking now, thanks

>< http://www.perldoc.com/perl5.8.0/pod/perlfaq6.html
>#I'm-having-trouble-matching-over-more-than-one-line.--What's-wrong- >
>
>But you're concentrating on the wrong problem at that point, IMHO.

I am quite willing to accept that!!



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

Date: Wed, 13 Aug 2003 09:16:50 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: replace space only within quotes with something else
Message-Id: <slrnbjki2i.3jt.tadmc@magna.augustmail.com>

Sunil <sunil_franklin@hotmail.com> wrote:


> change all occurrences of space with some other characters, only if they are
> within double quotes


   s{ ( " [^"]* " ) } {
      $a = $1;
      $a =~ tr/ /#/;
      $a
    }xge;


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


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

Date: Wed, 13 Aug 2003 15:01:36 GMT
From: Gunter Schelfhout <nospam@please.com>
Subject: Re: replace space only within quotes with something else
Message-Id: <kps_a.65010$F92.7358@afrodite.telenet-ops.be>

Sunil wrote:

> All,
>     Other than going char by character and doing it is there a way I can
> change all occurrences of space with some other characters, only if they
> are within double quotes
>     E.g.
>                 'this is a sample "which has to" be converted'
>     has to become
>                 'this is a sample "which#has#to" be converted'
> 
>     assuming I am replacing spaces with #
> 

Try this oneliner. At least it will give you an idea.
(no doubt there is a shorter version)

perl -MEnglish -ne '/".+"/; ($before, $after) = ($PREMATCH, $POSTMATCH);
($match = $MATCH) =~ s/ /#/g; print "$before$match$after"' <file_to_change>

-- 
Blood, sweat & tears


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

Date: 13 Aug 2003 11:17:07 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Replacing identical lines in a RE
Message-Id: <slrnbjk7hj.v2p.abigail@alexandra.abigail.nl>

Francois Wisard (zebu@pingou.ath.cx) wrote on MMMDCXXXIV September
MCMXCIII in <URL:news:slrnbjj0vd.4sq.zebu@pingou.ath.cx>:
$$  Hi,
$$  
$$  I have a problem with a one-liner.
$$  I have this data:
$$  
$$  %
$$  I WAS NOT TOUCHED "THERE" BY AN ANGEL
$$  I WAS NOT TOUCHED "THERE" BY AN ANGEL
$$  I WAS NOT TOUCHED "THERE" BY AN ANGEL
$$  I WAS NOT TOUCHED "THERE" BY AN ANGEL
$$  
$$          Bart Simpson on chalkboard in episode BABF14
$$  %
$$  I AM NOT HERE ON A FARTBALL SCHOLARSHIP
$$  I AM NOT HERE ON A FARTBALL SCHOLARSHIP
$$  I AM NOT HERE ON A FARTBALL SCHOLARSHIP
$$  I AM NOT HERE ON A FARTBALL SCHOLARSHIP
$$  etc..
$$  
$$  and I want this output:
$$  
$$  %
$$  I WAS NOT TOUCHED "THERE" BY AN ANGEL
$$  I WAS NOT TOUCHED "THERE" BY AN ANGEL
$$  I WAS NOT TOUCHED "THERE" BY AN ANGEL
$$          Bart Simpson on chalkboard in episode BABF14
$$  %
$$  I AM NOT HERE ON A FARTBALL SCHOLARSHIP
$$  I AM NOT HERE ON A FARTBALL SCHOLARSHIP
$$  I AM NOT HERE ON A FARTBALL SCHOLARSHIP
$$  etc.

    perl -nle 'if($_ eq$:){next if++$;>2}else{$;=0}$:=$_;print if/\S/' file


Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
 .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
 .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'


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

Date: 13 Aug 2003 11:24:27 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: substitute three random words in a string
Message-Id: <slrnbjk7vb.v2p.abigail@alexandra.abigail.nl>

Hudson (scripts_you-know-the-drill_@hudsonscripting.com) wrote on
MMMDCXXXIV September MCMXCIII in <URL:news:8bjjjvso1bne2s5b3scgd8id84fn0cok42@4ax.com>:
'' >Try:
'' >
'' >    $_ =~ s/_one_/randomize_one()/eg;
'' >
''  
''  I'll have to go do the reading and testing tomorrow, but just off the
''  top of my head, would something like this work?
''  
''  $_ =~ s/_one_/fisher_yates_shuffle( \@one ); $one[0]/eg;


Yeah, in the way taking a dip in the Pacific works if you go from
New York to Washington.

Why shuffle an entire array if you want a random element? If a magician
asks you to pick a random card from a deck, would you take the deck,
shuffle it, and pick the first one?

Picking a random element from an array doesn't take more than:

    $one [rand @one]


Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


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

Date: Wed, 13 Aug 2003 08:32:03 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: using Getopt::Long with option value having spaces
Message-Id: <87r83pfzu4.fsf@limey.hpcc.uh.edu>

>> On Wed, 13 Aug 2003 14:21:36 +0530,
>> "Sunil" <sunil_franklin@hotmail.com> said:

> All, I am trying to use GetOptions to get the values
> corresponding to options in a string like in

> #################################################### my
> $eval_string = '@ARGV = qw (' . "$scriptOptions" . ' )'
> ; eval $eval_string; GetOptions("fwk=s" => \$framework,
> "mode=s" => \$errMode, "args=s" => \@arguments,
> "comments=s" => \$comments );
> ####################################################

>  The problem I am having is that if $scriptOptions
> contains something like -comments="this is a comment", I
> get only "this as the comment as GetOptions does not
> take kindly to option values having spaces. Is there any
> workaround for this?

The " around the value of $scriptOptions are part of the
perl syntax, not part of the string.

I'm not sure why you would want to fiddle with @ARGV
though?  IMHO the point of something like Getopt::Long is
to take unstructured text from the command-line and turn
it into a usable data structure.  If you've already got
the data in the program why try to push it back out and
pull(*) it in again?

hth
t

(*) REXX pun.


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

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


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