[28154] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9518 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 24 14:05:54 2006

Date: Mon, 24 Jul 2006 11: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           Mon, 24 Jul 2006     Volume: 10 Number: 9518

Today's topics:
        fontsize and/or space between lines <"v.niekerk at hccnet.nl">
    Re: fontsize and/or space between lines <mritty@gmail.com>
    Re: fontsize and/or space between lines <"v.niekerk at hccnet.nl">
        How to match crossing line? <kevinmiter@gmail.com>
    Re: How to match crossing line? <jurgenex@hotmail.com>
    Re: How to match crossing line? <kevinmiter@gmail.com>
    Re: How to match crossing line? <jurgenex@hotmail.com>
    Re: How to match crossing line? <kevinmiter@gmail.com>
    Re: Idiot Q: How to find index number of HASH match? <franzl.wisseworst@mailinator.net>
        method connecting outlook express to webmail script <lloyde@dodo.com.au>
    Re: method connecting outlook express to webmail script <1usa@llenroc.ude.invalid>
        Perl not deleting file content if file on server <youcontrol@hispeed.ch>
    Re: Perl not deleting file content if file on server <mritty@gmail.com>
    Re: Perl not deleting file content if file on server <1usa@llenroc.ude.invalid>
    Re: Perl not deleting file content if file on server <youcontrol@hispeed.ch>
        Regex query <cwebhosting@googlemail.com>
    Re: Regex query <cwebhosting@googlemail.com>
    Re: Regex query <mritty@gmail.com>
    Re: Regex query <josef.moellers@fujitsu-siemens.com>
    Re: Regex query <simon.chao@fmr.com>
    Re: Regex query <cwebhosting@googlemail.com>
        Semantics of threads <blgl@stacken.kth.se>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 24 Jul 2006 16:02:27 +0200
From: Huub <"v.niekerk at hccnet.nl">
Subject: fontsize and/or space between lines
Message-Id: <44c4d69d$0$19566$e4fe514c@dreader11.news.xs4all.nl>

Hi,

Looking through CPAN I found font modules, but I can't figure if I can 
use them for printing small(er) fonts. Also, is there a possibilty to 
change the space between lines? If so, what should I look for (what is 
it called in English?) ?

Thanks,

Huub


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

Date: 24 Jul 2006 07:12:38 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: fontsize and/or space between lines
Message-Id: <1153750358.914238.193310@s13g2000cwa.googlegroups.com>

Huub wrote:
> Looking through CPAN I found font modules,

*What* modules?  Give us names.

>  but I can't figure if I can
> use them for printing small(er) fonts

Printing to *what*?

>. Also, is there a possibilty to
> change the space between lines?

*What* lines?  What are you printing to? Are you talking about printing
to a Unix terminal?  A Microsoft World document?  A plain text file?
The answer to your question is heavily dependent upon the answer to
that.

> If so, what should I look for (what is  it called in English?) ?

Line Spacing?

Paul Lalli



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

Date: Mon, 24 Jul 2006 16:40:46 +0200
From: Huub <"v.niekerk at hccnet.nl">
Subject: Re: fontsize and/or space between lines
Message-Id: <44c4dc0b$0$18480$e4fe514c@dreader26.news.xs4all.nl>

> 
> *What* modules?  Give us names.

Like these: Font::FreeType found at 
http://search.cpan.org/search?query=font&mode=module

>> 
> Printing to *what*?

Printing ASCII to a HP DeskJet520

>
> *What* lines?  What are you printing to? Are you talking about printing
> to a Unix terminal?  A Microsoft World document?  A plain text file?
> The answer to your question is heavily dependent upon the answer to
> that.

I've written a script to print address labels with 4 lines per label. A 
problem is that the distance between each 2 lines is just too much (or 
large?). Result is that after 2 or 3 labels downwards, the last line of 
the label is partly being printed on the next-lower label.

> 
>> If so, what should I look for (what is  it called in English?) ?
> 
> Line Spacing?

That could be it.

Thank you for helping out,

Huub


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

Date: 24 Jul 2006 04:31:52 -0700
From: "firenet" <kevinmiter@gmail.com>
Subject: How to match crossing line?
Message-Id: <1153740712.065482.4010@s13g2000cwa.googlegroups.com>

#!/usr/bin/perl -w
undef $/;
$temp=<>;
#print $temp;
$temp =~ /author (.*?)<\/a>/gs;
print $1;

I want to get Brian W.Kerniham below.But i get a message"Use of
uninitialized value in print at sss.pl line 6, <> chunk 1." what's
wrong? Thank you.

<br><span class="pl2">author: <a
href=http://www.douban.com/subject_search?search_text=Brian%20W.Kernigham&amp;cat=1001>
Brian W.Kernigham</a>



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

Date: Mon, 24 Jul 2006 11:40:09 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: How to match crossing line?
Message-Id: <tk2xg.2048$K94.1758@trnddc01>

firenet wrote:
> #!/usr/bin/perl -w
> undef $/;
> $temp=<>;
> #print $temp;
> $temp =~ /author (.*?)<\/a>/gs;
> print $1;

You should _always_ test is the pattern match sussessfull before using the 
captured result.
Had you done that
    if ($temp =~ /author (.*?)<\/a>/gs) {
        print $1;
    } else {
        print 'Can\'t match /author (.*?)<\/a>/';
    }
then perl would have told you.

> I want to get Brian W.Kerniham below.But i get a message"Use of
> uninitialized value in print at sss.pl line 6, <> chunk 1." what's
> wrong? Thank you.
>
> <br><span class="pl2">author: <a
> href=http://www.douban.com/subject_search?search_text=Brian%20W.Kernigham&amp;cat=1001>
> Brian W.Kernigham</a>

jue 




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

Date: 24 Jul 2006 04:48:57 -0700
From: "firenet" <kevinmiter@gmail.com>
Subject: Re: How to match crossing line?
Message-Id: <1153741737.005964.40570@m73g2000cwd.googlegroups.com>

I did it as you told. it can't match.
But what should the rexp be?
J=FCrgen Exner wrote:
> firenet wrote:
> > #!/usr/bin/perl -w
> > undef $/;
> > $temp=3D<>;
> > #print $temp;
> > $temp =3D~ /author (.*?)<\/a>/gs;
> > print $1;
>
> You should _always_ test is the pattern match sussessfull before using the
> captured result.
> Had you done that
>     if ($temp =3D~ /author (.*?)<\/a>/gs) {
>         print $1;
>     } else {
>         print 'Can\'t match /author (.*?)<\/a>/';
>     }
> then perl would have told you.
>
> > I want to get Brian W.Kerniham below.But i get a message"Use of
> > uninitialized value in print at sss.pl line 6, <> chunk 1." what's
> > wrong? Thank you.
> >
> > <br><span class=3D"pl2">author: <a
> > href=3Dhttp://www.douban.com/subject_search?search_text=3DBrian%20W.Ker=
nigham&amp;cat=3D1001>
> > Brian W.Kernigham</a>
>=20
> jue



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

Date: Mon, 24 Jul 2006 12:03:16 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: How to match crossing line?
Message-Id: <8G2xg.10286$Oz3.4839@trnddc02>

firenet wrote:
>> firenet wrote:
>>> $temp =~ /author (.*?)<\/a>/gs;
              ^^^^^^^
                    |

>>> <br><span class="pl2">author: <a
                          ^^^^^^^
                                |

> But what should the rexp be?

Did you notice the difference in the first character after 'author'?

jue 




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

Date: 24 Jul 2006 05:16:32 -0700
From: "firenet" <kevinmiter@gmail.com>
Subject: Re: How to match crossing line?
Message-Id: <1153743392.134460.229030@b28g2000cwb.googlegroups.com>

thank you! i get the name but also the <a herf=3Durl>
i'll work to get rid of it!
thanks again
J=FCrgen Exner wrote:
> firenet wrote:
> >> firenet wrote:
> >>> $temp =3D~ /author (.*?)<\/a>/gs;
>               ^^^^^^^
>                     |
>
> >>> <br><span class=3D"pl2">author: <a
>                           ^^^^^^^
>                                 |
>
> > But what should the rexp be?
>
> Did you notice the difference in the first character after 'author'?
>=20
> jue



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

Date: Mon, 24 Jul 2006 16:59:30 +0200
From: Franzl Wisseworst <franzl.wisseworst@mailinator.net>
Subject: Re: Idiot Q: How to find index number of HASH match?
Message-Id: <ea2o6r$vli$00$1@news.t-online.com>

Mumia W. wrote:

[..]

> my $match_index = $obj_en->Indices($current::page);
> my $string = defined $match_index ? $match_index : "404.html";

Many thanks for posting this untested bit of code, it works like magic!

> I think that a multi-dimensional hash/array would be easier:

I have an itching feeling that you're right. The looping procedures of the 
multi-dimensional hash/array are however a bit hard for me to swallow, and 
so I think the above solution will serve its purpose for the time being, 
while the below example goes on my pinboard reserved for a future purpose, 
mainly because I need to half understand the code before I can maintain it.

Thanks for the excellent code!

> 
> my %lg = (
>      en,pages => [ 'page1.html', 'bla.html', 'something.html' ],
>      en,text => [ 'pageone', 'blabla', 'something' ],
> 
>      de,pages => [ 'seite1.html', 'blau.html', 'ding.html' ],
>      de,text => [ 'Seite ens', 'blau', 'Ding' ],
> 
> );
> 
> $; = ',';
> 
> my %lgn;
> foreach my $x (grep /,pages$/ keys %lg) {
>      foreach my $y (0..$#{$lg{$x}}) {
>          my $aref = $lg{$x};
>          $lgn{"$aref->[$y]"} = $y;
>      }
> }
> 
> # Answer Q1: No need. @{ $lg{'en,pages'} } is already an array.
> 
> # Answer Q2:
> my $match_index = $lgn{$current::page};
> 
> 
> ALL CODE UNTESTED




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

Date: 24 Jul 2006 08:18:57 -0700
From: "lloydie" <lloyde@dodo.com.au>
Subject: method connecting outlook express to webmail script
Message-Id: <1153754336.544153.308450@m73g2000cwd.googlegroups.com>

I have written a webmail script and almost completed it except for the
process of having Outlook Express able to connect to the script to
download messages similar to accessing Hotmail or Yahoo.

I believe this is possible but I cant find documentation for doing so
and I have read so much recently ....about a week of it so far....but
to no avail and not sure how it can be done.

My script receives, deletes messages from multiple email servers and I
want Outlook Express to access this instead of each ISP
seperately.....allowing web access before downloading from same.

I am requiring the method and module to use for the process.

An help on this subject is much appreciated.

Thanks in advance.
Lloyd Etheridge



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

Date: Mon, 24 Jul 2006 15:27:45 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: method connecting outlook express to webmail script
Message-Id: <Xns980A74B259E98asu1cornelledu@127.0.0.1>

"lloydie" <lloyde@dodo.com.au> wrote in news:1153754336.544153.308450
@m73g2000cwd.googlegroups.com:

> I have written a webmail script

What is a webmail script?

> and almost completed it except for the
> process of having Outlook Express able to connect to the script to
> download messages similar to accessing Hotmail or Yahoo.

Do you want to set up a local POP3 or IMAP server?

> My script receives, deletes messages from multiple email servers and I
> want Outlook Express to access this instead of each ISP
> seperately.....allowing web access before downloading from same.

I am not sure what you mean by this.

Sinan
-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: Mon, 24 Jul 2006 16:52:36 +0200
From: =?ISO-8859-1?Q?Markus_H=E4nchen?= <youcontrol@hispeed.ch>
Subject: Perl not deleting file content if file on server
Message-Id: <44c4dead@news1.ethz.ch>

Hi,

using
	open RESULTS, ">results.txt";
does not delete the contents of the file if the file sits on a server.  
However, using print I can overwrite as many characters as I want. For 
example, if the content of the file is 'Fred went home.', and I write 
(via print) 'Carl' then only the first four characters get replaced 
with rest remaining, i.e. the file will look now 'Carl went home.'. I 
can also append to the file using:
	open RESULTS, ">>results.txt";

If the file sits on C:\\, then using
	open RESULTS, ">results.txt";
actually wipes the file and 'Fred went home.' turns into 'Carl' only.

Is this known and expected behaviour, and is there a way to force it to 
wipe out the content of a file?

Running on a Windows 2000 machine using the latest PXPerl 
(http://pxperl.com) installation, the 'server' actually being a shared 
folder in VirtualPC (which Windows sees as a server).

Cheers

Markus



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

Date: 24 Jul 2006 08:12:18 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Perl not deleting file content if file on server
Message-Id: <1153753938.632647.99710@75g2000cwc.googlegroups.com>

Markus H=E4nchen wrote:
> using
> 	open RESULTS, ">results.txt";
> does not delete the contents of the file if the file sits on a server.

This is non sensical.  The fact that the machine the file resides on
happens to also be running one or more server programs has no causal
relationship to opening a file.

Please better define *what* you are doing.  Are you attempting to open
a file remotely?  If so, the code you've shown is clearly not your real
code.

Please post a SHORT but COMPLETE script that demonstrates the error you
are seeing.

> However, using print I can overwrite as many characters as I want. For
> example, if the content of the file is 'Fred went home.', and I write
> (via print) 'Carl' then only the first four characters get replaced
> with rest remaining, i.e. the file will look now 'Carl went home.'. I
> can also append to the file using:
> 	open RESULTS, ">>results.txt";
>
> If the file sits on C:\\, then using
> 	open RESULTS, ">results.txt";
> actually wipes the file and 'Fred went home.' turns into 'Carl' only.
>
> Is this known and expected behaviour, and is there a way to force it to
> wipe out the content of a file?

Perhaps trunctate() will do what you want?
perldoc -f truncate

Paul Lalli



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

Date: Mon, 24 Jul 2006 15:19:19 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Perl not deleting file content if file on server
Message-Id: <Xns980A7344A30ACasu1cornelledu@127.0.0.1>

Markus Hänchen <youcontrol@hispeed.ch> wrote in 
news:44c4dead@news1.ethz.ch:

> using
>      open RESULTS, ">results.txt";
> does not delete the contents of the file if the file sits on a server.  
> However, using print I can overwrite as many characters as I want. For 
> example, if the content of the file is 'Fred went home.', and I write 
> (via print) 'Carl' then only the first four characters get replaced 
> with rest remaining, i.e. the file will look now 'Carl went home.'. I 
> can also append to the file using:
>      open RESULTS, ">>results.txt";
> 
> If the file sits on C:\\, then using
>      open RESULTS, ">results.txt";
> actually wipes the file and 'Fred went home.' turns into 'Carl' only.

Your description just cannot replace actual code and output.

In particular, I have no idea what you mean by 'server'. 

Also, you do not show any error checking.

Do you properly close the file?

Please consult the posting guidelines for this group, and revise your 
post in accordance with those guidelines.

D:\UseNet\clpmisc> cat results.txt
Fred went home.

D:\UseNet\clpmisc> cat ff.pl
#!/usr/bin/perl

use strict;
use warnings;

my $filename = 'results.txt';

open my $fh, '>', $filename
    or die "Cannot open '$filename': $!";

close $fh
    or die "Cannot close '$filename': $!";
__END__


D:\UseNet\clpmisc> ff

D:\UseNet\clpmisc> cat results.txt



-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: Mon, 24 Jul 2006 18:39:41 +0200
From: =?ISO-8859-1?Q?Markus_H=E4nchen?= <youcontrol@hispeed.ch>
Subject: Re: Perl not deleting file content if file on server
Message-Id: <44c4f7cd@news1.ethz.ch>

>> Perhaps trunctate() will do what you want?
> perldoc -f truncate
> 
> Paul Lalli

Thanks a lot, truncate does do the job.



And thanks for the other reply as well. Since I am working in Windows 
(i.e. DOS) I cannot use 'cat' but I try to provide equivalent 
information:

(Drive z is recognized by Windows as 'type: Network Drive', it actually 
is a folder sitting on the harddrive of my Mac which is made available 
to Windows.)

(First: results.txt does not exist yet)
z:\Work\results.txt
'results.txt' does not exist

(First script:)
z:\Work\notwiping1.pl
#! /usr/bin/perl

use strict;
use warnings;

open RESULTS, ">results.txt";
    print RESULTS "Fred went home.\t";
close RESULTS;

z:\Work\perl notwiping1.pl

z:\Work\results.txt
Fred went home.

(Second script:)
z:\Work\notwiping2.pl
#! /usr/bin/perl

use strict;
use warnings;

open RESULTS, ">results.txt";
    print RESULTS "Carl";
close RESULTS;

z:\Work\perl notwiping2.pl

z:\Work\results.txt
Carl went home.


-------------
Now if I do exactly the same on
c:\running_perl\perl notwiping1.pl

c:\running_perl\results.txt
Fred went home.

(Second script:)
c:\running_perl\perl notwiping2.pl

z:\Work\results.txt
Carl













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

Date: 24 Jul 2006 07:03:50 -0700
From: "Dave" <cwebhosting@googlemail.com>
Subject: Regex query
Message-Id: <1153749830.872058.155220@b28g2000cwb.googlegroups.com>

Hi,

I hope this is the right forum as I am doing this from perl.

I wish to use the search/replace functionality to strip out periods
from a string, but leave the first.

i.e. Change from "this.file.name.is.messy.txt" to "this file name is
messy.txt"

The file extension can be any length or any name.

So far I have tried a few things but my perl/regex knowledge is
something I am only recently building up again. I have looked through
the tutorials but nothing suitable has caught my eye.

I would like to do it in one nicely performing regex if at all
possible.

Things I have tried...

s/\.([^(txt)|^(html)])/ \1/g; # then I realised you cannot have
groupings inside a character class etc.

s/\.(\w+$){0}/ \1/g; # Well the {0} doesn't do what I was hoping for

s/\.(.+\..+)$/ \1/g; # Works if I iterate it externally enough times.

What I would love is something like s/\.(but not where \w+$ matches
here)/ /g; but I am stuck. All I want to know is if I can do this in a
regex oneliner and if so, some clues on where I should be looking :)
I'd like to work it out myself but am gonna have to ask you guys.

Cheers,

Dave



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

Date: 24 Jul 2006 07:08:43 -0700
From: "Dave" <cwebhosting@googlemail.com>
Subject: Re: Regex query
Message-Id: <1153750123.072594.179830@b28g2000cwb.googlegroups.com>

> I wish to use the search/replace functionality to strip out periods
> from a string, but leave the first.
Of course, when I said first.. I meant last :)

D...



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

Date: 24 Jul 2006 07:19:20 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Regex query
Message-Id: <1153750760.617621.250190@m73g2000cwd.googlegroups.com>

Dave wrote:
> I hope this is the right forum as I am doing this from perl.
>
> I wish to use the search/replace functionality to strip out periods
> from a string, but leave the first.
>
> i.e. Change from "this.file.name.is.messy.txt" to "this file name is
> messy.txt"
>
> The file extension can be any length or any name.
>
> So far I have tried a few things but my perl/regex knowledge is
> something I am only recently building up again. I have looked through
> the tutorials but nothing suitable has caught my eye.
>
> I would like to do it in one nicely performing regex if at all
> possible.
>
> Things I have tried...
>
> s/\.([^(txt)|^(html)])/ \1/g; # then I realised you cannot have
> groupings inside a character class etc.
>
> s/\.(\w+$){0}/ \1/g; # Well the {0} doesn't do what I was hoping for
>
> s/\.(.+\..+)$/ \1/g; # Works if I iterate it externally enough times.
>
> What I would love is something like s/\.(but not where \w+$ matches
> here)/ /g;

You can.  Read perldoc perlre again, and look for "lookahead
assertions"

> but I am stuck. All I want to know is if I can do this in a
> regex oneliner and if so, some clues on where I should be looking :)

Note that you can translate your pseudo code above directly, but I
would recommend instead something like
s/\.(but only if another period follows somewhere)/ /g;
instead.  Again, look up the look-ahead assertions.

> I'd like to work it out myself but am gonna have to ask you guys.

If you still can't figure it out after reading about lookaheads, post
again.

Paul Lalli



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

Date: Mon, 24 Jul 2006 16:17:11 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Regex query
Message-Id: <ea2l1v$pvl$1@nntp.fujitsu-siemens.com>

Dave wrote:
> Hi,
>=20
> I hope this is the right forum as I am doing this from perl.
>=20
> I wish to use the search/replace functionality to strip out periods
> from a string, but leave the first.
>=20
> i.e. Change from "this.file.name.is.messy.txt" to "this file name is
> messy.txt"
>=20
> The file extension can be any length or any name.
>=20
> So far I have tried a few things but my perl/regex knowledge is
> something I am only recently building up again. I have looked through
> the tutorials but nothing suitable has caught my eye.
>=20
> I would like to do it in one nicely performing regex if at all
> possible.
>=20
> Things I have tried...
>=20
> s/\.([^(txt)|^(html)])/ \1/g; # then I realised you cannot have
> groupings inside a character class etc.
>=20
> s/\.(\w+$){0}/ \1/g; # Well the {0} doesn't do what I was hoping for
>=20
> s/\.(.+\..+)$/ \1/g; # Works if I iterate it externally enough times.
>=20
> What I would love is something like s/\.(but not where \w+$ matches
> here)/ /g; but I am stuck. All I want to know is if I can do this in a
> regex oneliner and if so, some clues on where I should be looking :)
> I'd like to work it out myself but am gonna have to ask you guys.

I'm not sure if it can be done by a single s///. I'd do it by checking=20
for multiple .:

($s =3D~ s/\./ /) while ($s =3D~ /\..*\./);

Ex:
my $s =3D "this.file.name.is.messy.txt";
($s =3D~ s/\./ /) while ($s =3D~ /\..*\./);
print "$s\n";

Output:
this file name is messy.txt

Josef
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett



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

Date: 24 Jul 2006 07:29:37 -0700
From: "it_says_BALLS_on_your forehead" <simon.chao@fmr.com>
Subject: Re: Regex query
Message-Id: <1153751377.250612.316400@m73g2000cwd.googlegroups.com>


Dave wrote:
> Hi,
>
> I hope this is the right forum as I am doing this from perl.
>
> I wish to use the search/replace functionality to strip out periods
> from a string, but leave the first.
>
> i.e. Change from "this.file.name.is.messy.txt" to "this file name is
> messy.txt"
>
> The file extension can be any length or any name.
>
> So far I have tried a few things but my perl/regex knowledge is
> something I am only recently building up again. I have looked through
> the tutorials but nothing suitable has caught my eye.
>
> I would like to do it in one nicely performing regex if at all
> possible.
>
> Things I have tried...
>
> s/\.([^(txt)|^(html)])/ \1/g; # then I realised you cannot have
> groupings inside a character class etc.
>
> s/\.(\w+$){0}/ \1/g; # Well the {0} doesn't do what I was hoping for
>
> s/\.(.+\..+)$/ \1/g; # Works if I iterate it externally enough times.
>
> What I would love is something like s/\.(but not where \w+$ matches
> here)/ /g; but I am stuck. All I want to know is if I can do this in a
> regex oneliner and if so, some clues on where I should be looking :)
> I'd like to work it out myself but am gonna have to ask you guys.

use strict; use warnings;

my $str = 'this.file.name.is.messy.txt';
$str =~ s/\.(?=.*\.)/\ /g;
print $str, "\n";



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

Date: 24 Jul 2006 08:08:19 -0700
From: "Dave" <cwebhosting@googlemail.com>
Subject: Re: Regex query
Message-Id: <1153753699.228997.154770@m79g2000cwm.googlegroups.com>

Cheers guys.

I did it with negative lookahead after going back to the docs. I just
did not know what i was looking for. Now I do :)

I will use the updated pseudocode (i.e. check for more periods rather
than a following string at the end of the line).

Ta.



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

Date: Mon, 24 Jul 2006 18:53:52 +0200
From: Bo Lindbergh <blgl@stacken.kth.se>
Subject: Semantics of threads
Message-Id: <ea2tv3$6ub$1@news.su.se>

perldoc perlthrtut says:
> Thinking of mixing fork() and threads?  Please lie down and wait until
> the feeling passes.  Be aware that the semantics of fork() vary between
> platforms.  For example, some UNIX systems copy all the current threads
> into the child process, while others only copy the thread that called
> fork(). You have been warned!

Does this mean that if more than one thread exists, the qx operator,
the system function, and the open function in pipe mode all have
undefined behaviour?


/Bo Lindbergh


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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


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