[23598] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5805 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 14 18:05:46 2003

Date: Fri, 14 Nov 2003 15: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)

Perl-Users Digest           Fri, 14 Nov 2003     Volume: 10 Number: 5805

Today's topics:
    Re: "tree" view of directory <mikeflan@earthlink.net>
    Re: ALRM weirdness in Perl 5.8.0 <andy@andyh.co.uk>
    Re: ALRM weirdness in Perl 5.8.0 <admin@asarian-host.net>
    Re: ALRM weirdness in Perl 5.8.0 <nospam-abuse@ilyaz.org>
    Re: ALRM weirdness in Perl 5.8.0 <rgarciasuarez@free.fr>
    Re: ALRM weirdness in Perl 5.8.0 <admin@asarian-host.net>
        Argv 0, $0, and $^X (Alan Barclay)
    Re: BE CAREFUL WITH THIS - PROBABLY A VIRUS !!! <raistlin@nospamfankoo.com>
    Re: Dynamic regexp <KlausRusch@atmedia.net>
    Re: Dynamic regexp (Greg Bacon)
    Re: Dynamic regexp (Greg Bacon)
    Re: Dynamic regexp (Malcolm Dew-Jones)
    Re: Dynamic regexp <nobull@mail.com>
    Re: Dynamic regexp <nobull@mail.com>
    Re: Giving back <jwillmore@remove.adelphia.net>
    Re: Is a value a decimal number or not? (John Stanley)
        regex to convert 1000000 -> 1,000,000 ? (bad_knee)
    Re: regex to convert 1000000 -> 1,000,000 ? <tore@aursand.no>
    Re: regex to convert 1000000 -> 1,000,000 ? <nobull@mail.com>
        setvbuf broken in Redhat9? <rowe@excc.ex.ac.uk>
    Re: setvbuf broken in Redhat9? <rgarciasuarez@free.fr>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 14 Nov 2003 19:15:51 GMT
From: Mike Flannigan <mikeflan@earthlink.net>
Subject: Re: "tree" view of directory
Message-Id: <3FB52AA0.93ACFBEA@earthlink.net>


Jay Tilton wrote:

> Is the directory really empty?
>
> Those two files are typically found in the root directory of the boot
> partition on a Windows box.  It would be unusual for that partition to
> have nothing else.
>
> One thing that can send the program off its rails is if you start it in
> a volume's root directory, e.g.
>
>     perl file.pl c:/
>
> Then, because it uses "$dir/$file" to concatenate the directory with the
> filename, it will try to stat filenames like "c://foo" .  You might look
> at the catfile() method in the File::Spec module to do this part of the
> task handily and portably.
>

I'm on Win2000.
Yeah, it shows as an empty directory.  It's a sub directory of the
root directory.  Here's the output:

Directories under "c:\copy2"

c:\copy2\Io.sys
c:\copy2\Msdos.sys

0 total directories


I suspect those are the . and .. listed in each directory
under DOS.


When I run the program on c:\ is takes about 2 minutes or so,
but lists all 50,000+ files and 3,100+ directories on my hard
drive.  Pretty cool.  I have it write to a file.  Here is the finished
product, though it could use a little more work:


#
#
# This perl script gives a full listing of files and directories
# in a given directory.  The output is put in c:\Perl\00MikeF\dir.txt
# Command syntax is "perl [filename].pl c:\" to list out the
# entire contents of the local computer.
#
#
use English;

sub search_dir
{
        local ( $dirname ) = @_;
        local ( @entries , $entry , $path , @dirs_list , $dircount ,
@files );

        if ( ! opendir(DIR,$dirname) ) {
                print STDERR "opendir failed for \"$dirname\" : $!\n";
                return 0;
        } # IF
        @entries = readdir DIR;
        closedir DIR;

        @dirs_list = ();
        @files = ();
        $dircount = 0;
        foreach $entry ( @entries ) {
                if ( $entry eq "." || $entry eq ".." ) {
                        next;
                } # IF
                $path = sprintf "%s\\%s",$dirname,$entry;
                if ( -d $path && $entry ne "." && $entry ne ".." ) {
                        $dircount += 1;
                        push(@dirs_list,$entry);
                        print DIROUT "$path [dir]\n";
                } # IF
                else {
                        push @files,$entry;
                } # ELSE
        } # FOREACH
        print DIROUT "\n";
        if ( 0 < @files ) {
                foreach $entry ( @files ) {
                        print DIROUT $dirname,"\\",$entry,"\n";
                } # FOREACH
        } # IF
        foreach $entry ( @dirs_list ) {
                $dircount += &search_dir($dirname."\\".$entry);
        } # FOREACH;
        return $dircount;
} # end of search_dir

MAIN:
{
        open DIROUT, ">dir.txt" or die "$0: open dir.txt: $!";
        local ( $dirname , $count );

        $dirname = ( $#ARGV >= 0 ) ? $ARGV[0] : ".";
        print DIROUT "Directories under \"$dirname\"\n";
        $count = &search_dir($dirname);
        print DIROUT "\n$count total directories\n";
        close DIROUT;
        exit 0;
} # end of MAIN

__END__



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

Date: Fri, 14 Nov 2003 21:28:59 +0000
From: Andy Hassall <andy@andyh.co.uk>
Subject: Re: ALRM weirdness in Perl 5.8.0
Message-Id: <ksharv4br937dp5ldflndp7tj6sjrt5oci@4ax.com>

On Fri, 14 Nov 2003 17:05:20 +0100, "Mark" <admin@asarian-host.net> wrote:

>Using Perl 5.8.0, with threads, I am having the darndest problem getting
>ALRM to work.
>
>First of all, setting off an ALRM would crash the program (a Milter)
>altogether. Doing a wee research revealed, that, for reasons unknown, it is
>imperative you set this BEFORE you go threading:
>
>$SIG{'ALRM'} = 'DEFAULT';

 Due to the following?

http://nntp.x.perl.org/group/perl.perl5.porters/65762

>So I did. And, indeed, the crashes stopped. Weird by itself, but something I
>can live with. :) What I cannot live with, however, is that my ALRM is still
>not triggered! The actual code using the ALRM is a subroutine checking the
>AVP daemon for viruses. Like so:
>
[snip]
>
>Nothing top-notch, really. The "sleep 8;" is there only for the test, of
>course. But the ALRM is never triggered! As if totally non-existent. I can
>set "sub { exit 1 }", for all that matter, and still nothing happens.
>
>I tried a zillion permutations, with or wihout 'local', either set in
>advance or only local, but it makes no difference. Either the ALRM totally
>crashes the program, or is totally ignored. Maybe it is related to that
>whole 'safe signals' business. And there once was a brilliant man here who
>posted a way to get your 'old-style' signals back; are you still out there?
>:)
>
>Is there anyone out here who can shed some light on this? A really need my
>ALRM back at that location.

 I've been having similar problems with SIG{ALRM}, except with DBD::Oracle
(trying to use $SIG{ALRM} in an eval() to catch connection timeouts), and
without using threads (at least within my script).

 I'm not sure my problem's related to yours, but if you do get a solution to
this, I'd like to hear it too.

 What platform are you on? I've been having trouble on Solaris, but I'm
currently trying to get it working on Linux to see if it's a platform issue.

--
Andy Hassall (andy@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)


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

Date: Fri, 14 Nov 2003 23:12:36 +0100
From: "Mark" <admin@asarian-host.net>
Subject: Re: ALRM weirdness in Perl 5.8.0
Message-Id: <gNGdnZI3iKbkziii4p2dnA@giganews.com>

"Andy Hassall" <andy@andyh.co.uk> wrote in message
news:ksharv4br937dp5ldflndp7tj6sjrt5oci@4ax.com...

> On Fri, 14 Nov 2003 17:05:20 +0100, "Mark" <admin@asarian-host.net> wrote:
>
> >Using Perl 5.8.0, with threads, I am having the darndest problem
> > getting ALRM to work.
> >
> >First of all, setting off an ALRM would crash the program (a Milter)
> >altogether. Doing a wee research revealed, that, for reasons unknown,
> > it is imperative you set this BEFORE you go threading:
> >
> >$SIG{'ALRM'} = 'DEFAULT';
>
>  Due to the following?
>
> http://nntp.x.perl.org/group/perl.perl5.porters/65762

Yes. That was *exactly the article I found the solution to the crashes in.
:)

>  I've been having similar problems with SIG{ALRM}, except with
> DBD::Oracle (trying to use $SIG{ALRM} in an eval() to catch
> connection timeouts), and without using threads (at least within
> my script).
>
>  I'm not sure my problem's related to yours, but if you do get a
> solution to this, I'd like to hear it too.
>
>  What platform are you on?

I should have mentioned that. I am on FreeBSD 4.7R. Although I doubt it is
platform related (well, at least not among unix variants).

I suspect it has something to do with the new "safe signals", which, if I
understood it correctly, may cause a signal to your process to be delayed
until a "safe" moment arrives. And in a threaded environment, the complexity
may be compounded. I noticed, for instance, that my ALRM (which I had it
write a syslog entry) actually *does go off, but only when the entire
program exists! That is a little too safe for my taste. :) But, so far, I
have been utterly unable to make it go off within the eval {} scope.

As soon as I have the solution, I will let you know too.

- Mark




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

Date: Fri, 14 Nov 2003 22:22:16 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: ALRM weirdness in Perl 5.8.0
Message-Id: <bp3kio$2sj8$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
Mark
<admin@asarian-host.net>], who wrote in article <Jsedna2MfKXXYCmiRVn-sA@giganews.com>:
> Using Perl 5.8.0, with threads, I am having the darndest problem getting
> ALRM to work.
> 
> First of all, setting off an ALRM would crash the program (a Milter)
> altogether. Doing a wee research revealed, that, for reasons unknown, it is
> imperative you set this BEFORE you go threading:
> 
> $SIG{'ALRM'} = 'DEFAULT';

I fail to understand what else could you expect.  alarm() uses
signals; behaviour of signals in the presence of threads is not defined.

Here is what I remember: on most (?) systems the signals are delivered
to thread 1.  On the rest (?) it is going to be delivered to a random
thread.

Are there systems which *guarantie* that alarm() will deliver SIGALRM
to the thread which issued alarm()?  What happens if the thread is not
there at the moment?

Hope this helps,
Ilya


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

Date: 14 Nov 2003 22:38:33 GMT
From: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
Subject: Re: ALRM weirdness in Perl 5.8.0
Message-Id: <slrnbramb1.c7c.rgarciasuarez@dat.local>

Ilya Zakharevich wrote in comp.lang.perl.misc :
> 
> I fail to understand what else could you expect.  alarm() uses
> signals; behaviour of signals in the presence of threads is not defined.
> 
> Here is what I remember: on most (?) systems the signals are delivered
> to thread 1.  On the rest (?) it is going to be delivered to a random
> thread.
> 
> Are there systems which *guarantie* that alarm() will deliver SIGALRM
> to the thread which issued alarm()?  What happens if the thread is not
> there at the moment?

Apparently older linux systems (2.2.x) affect pids to threads -- a
non-POSIX behaviour. As a side effect, threads appear to be signalable
there. See for example :
http://search.cpan.org/~elizabeth/Thread-Signal-1.10/lib/Thread/Signal.pm


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

Date: Fri, 14 Nov 2003 23:56:29 +0100
From: "Mark" <admin@asarian-host.net>
Subject: Re: ALRM weirdness in Perl 5.8.0
Message-Id: <mKydnS3Fkb81wCiiRVn-sA@giganews.com>

"Ilya Zakharevich" <nospam-abuse@ilyaz.org> wrote in message
news:bp3kio$2sj8$1@agate.berkeley.edu...

> > First of all, setting off an ALRM would crash the program (a Milter)
> > altogether. Doing a wee research revealed, that, for reasons unknown, it
> > is imperative you set this BEFORE you go threading:
> >
> > $SIG{'ALRM'} = 'DEFAULT';
>
> I fail to understand what else could you expect. alarm() uses
> signals; behaviour of signals in the presence of threads is not defined.
>
> Here is what I remember: on most (?) systems the signals are delivered to
> thread 1. On the rest (?) it is going to be delivered to a random thread.
>
> Are there systems which *guarantie* that alarm() will deliver SIGALRM
> to the thread which issued alarm()?  What happens if the thread is not
> there at the moment?
>
> Hope this helps, Ilya


Your post helped a lot. :) Thanks. In fact, it really makes sense, the way
you explain it. And it is consistent with what I recently found, that the
ALRM actually *does go off, but only when the entire program exits! Because,
I guess, when the 1st thread's number is up for exit, the ALRM gets honored.

I guess I will need something entirely different then to break out of the
eval {} within a thread. Any ideas? :) I really need some sort of ALRM.
Because last night the AVP daemon hang, so Milter hang along with it; and,
needless to say, I was not happy with that. :( I can set the timeout in
IO:Socket, of course; but that does, equally of course, not cover the
communcation with the AVP daemon.

Thanks anyway.

- Mark




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

Date: 14 Nov 2003 13:46:08 -0800
From: snuffle@canada.com (Alan Barclay)
Subject: Argv 0, $0, and $^X
Message-Id: <bfe9320e.0311141346.6e81a66@posting.google.com>

Using perl5.005 this script outputs 'zero'

#!/usr/bin/perl
 
exec {'/usr/bin/perl'} ('zero','-e','print $^X,"\n"');

Using 5.8.0 the same script gives /usr/bin/perl - the actual path of
perl.

Perlvar says 

       $^X     The name used to execute the current copy of Perl, from
C's
               "argv[0]".

But this isn't argv[0], because I forced argv[0] to be zero in my
script.

This is obviously a behaviour change somewhere between 5.005 and
5.8.0, and I can see how in some ways that 5.8.0 behaviour is more
useful, but there is definatly a conflict between the documented
behaviour and the actual behaviour. Which one is right?


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

Date: Fri, 14 Nov 2003 21:55:25 -0000
From: "Raistlin" <raistlin@nospamfankoo.com>
Subject: Re: BE CAREFUL WITH THIS - PROBABLY A VIRUS !!!
Message-Id: <jbctb.475$FC6.196@newsfep4-winn.server.ntli.net>


<SNIP>




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

Date: Fri, 14 Nov 2003 15:12:39 -0100
From: Klaus Johannes Rusch <KlausRusch@atmedia.net>
Subject: Re: Dynamic regexp
Message-Id: <3FB4FEF7.75B7185D@atmedia.net>

Winston Smith wrote:

> I'm looking for a way to make a batch of s/// substitutions. As a code
> sample is worth a thousand words, let see what me code is presently :
>
> ---
>
> my @rules = (
>     ['^HELLO (.*)$', 'BONJOUR $1'],
>     # ... lots of other rules
> );
>
> foreach my $rule (@rules) {
>     if ($string =~ s/$rule->[0]/$rule->[1]/ei) {
>        last;
>     }
> }
>
> ---
>
> With this code, 'HELLO WINSTON' becomes 'BONJOUR $1' and not 'BONJOUR
> WINSTON' as I'd like.

my @rules = (
    ['^HELLO (.*)$', '"BONJOUR $1"'],
);


foreach my $rule (@rules) {
    if ($string =~ s/$rule->[0]/eval($rule->[1])/ei) {
       last;
    }
}


--
Klaus Johannes Rusch
KlausRusch@atmedia.net
http://www.atmedia.net/KlausRusch/



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

Date: Fri, 14 Nov 2003 13:54:42 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: Dynamic regexp
Message-Id: <vr9nl2od83ou50@corp.supernews.com>

[Newsgroups field trimmed to remove comp.lang.perl.]

In article <2eZsb.44803$xI2.981453@news20.bellglobal.com>,
    Winston Smith  <winston_smith@linuxmail.org> wrote:

: my @rules = (
:     ['^HELLO (.*)$', 'BONJOUR $1'],
:     # ... lots of other rules
: );
: 
: foreach my $rule (@rules) {
:     if ($string =~ s/$rule->[0]/$rule->[1]/ei) {
:        last;
:     }
: }
: 
: ---
: 
: With this code, 'HELLO WINSTON' becomes 'BONJOUR $1' and not 'BONJOUR 
: WINSTON' as I'd like.

It requires a little chicanery because you can't use the FAQ answer
for "How can I expand variables in text strings?" -- you'd zap the
value of $1 you want to interpolate.  Note how I had to modify your
rule and make s/// do a double-eval:

    $ cat try
    #! /usr/local/bin/perl

    use warnings;
    use strict;

    my @rules = (
        ['^HELLO (.*)$', 'qq{BONJOUR $1}'],
        # ... lots of other rules
    );

    my $string = "HELLO WINSTON";

    print "before: [$string]\n";

    foreach my $rule (@rules) {
        if ($string =~ s/$rule->[0]/$rule->[1]/eei) {
            last;
        }
    }

    print "after:  [$string]\n";

    $ ./try
    before: [HELLO WINSTON]
    after:  [BONJOUR WINSTON]

Hope this helps,
Greg
-- 
This is the great illusion of our age, the idea that a certain class of
people [i.e., government] is exempt from the moral judgments that apply
to the rest of us.
    -- Gene Callahan


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

Date: Fri, 14 Nov 2003 15:50:48 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: Dynamic regexp
Message-Id: <vr9ueo89hukte0@corp.supernews.com>

In article <2eZsb.44803$xI2.981453@news20.bellglobal.com>,
    Winston Smith  <winston_smith@linuxmail.org> wrote:

: my @rules = (
:     ['^HELLO (.*)$', 'BONJOUR $1'],
:     # ... lots of other rules
: );
: 
: foreach my $rule (@rules) {
:     if ($string =~ s/$rule->[0]/$rule->[1]/ei) {
:        last;
:     }
: }

Here's a cleaner version than that in my other followup:

    #! /usr/local/bin/perl

    use warnings;
    use strict;

    my @rules = (
        ['^HELLO (.*)$', 'BONJOUR $1'],
        # ... lots of other rules
    );

    my $string = "HELLO WINSTON";

    print "before: [$string]\n";

    foreach my $rule (@rules) {
        if ($string =~ s/$rule->[0]/'qq{' . $rule->[1] . '}'/eei) {
            last;
        }
    }

    print "after:  [$string]\n";

Hope this helps,
Greg
-- 
Sufficiently advanced political correctness is indistinguishable
from irony.
    -- unknown


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

Date: 14 Nov 2003 11:50:14 -0800
From: yf110@victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Dynamic regexp
Message-Id: <3fb531f6@news.victoria.tc.ca>

Winston Smith (winston_smith@linuxmail.org) wrote:
: Hi everybody,

: I'm looking for a way to make a batch of s/// substitutions. As a code 
: sample is worth a thousand words, let see what me code is presently :

: ---

: my @rules = (
:     ['^HELLO (.*)$', 'BONJOUR $1'],
:     # ... lots of other rules
: );

: foreach my $rule (@rules) {
:     if ($string =~ s/$rule->[0]/$rule->[1]/ei) {

Two ways to do this (well there's more than two but this is enough)

1
	($string =~ s/$rule->[0]/"\"$rule->[1]\""/eei)
                                 ^^^          ^^^ ^^

OR

2

 '"BONJOUR $1"']
  ^          ^

	($string =~ s/$rule->[0]/$rule->[1]/eei)
                                            ^



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

Date: 14 Nov 2003 20:03:52 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Dynamic regexp
Message-Id: <u9oevelntj.fsf@wcl-l.bham.ac.uk>

gbacon@hiwaay.net (Greg Bacon) writes:

> It requires a little chicanery because you can't use the FAQ answer
> for "How can I expand variables in text strings?"

This, of course, is because the FAQ answer is $EXPLETIVE!

If the FAQ gave the true answer - rather than pretenting that a
different question was asked then you could use the FAQ answer.

I've tried several times to get the FAQ amended but the maintainers
are more concerned that the FAQ should not expose readers to
potentially dangerous techniques than that they actually answer the
questions honestly.

The honest answer to "How can I expand variables in text strings?" is:

  chop( $string = eval "<<__EOS__\n$string\n__EOS__\n" );
 
There are very good reasons why often the above is a bad idea.  (Let's
not discuss them here - we all know what they are).

However there is no good reason not to mention it in the FAQ.  When
someone wants to learn how to fell trees you tell them about chainsaws
and you tell them about the dangers of chainsaws.  You don't just tell
them some much less effective but less dangerous way and hope that
they won't discover chainsaws.  Of course they will discover
chainsaws and then:

  1) they'll not have had any training in their safe use.
  2) they'll never trust you again as a mentor.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 14 Nov 2003 20:13:11 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Dynamic regexp
Message-Id: <u9k762lne0.fsf@wcl-l.bham.ac.uk>

gbacon@hiwaay.net (Greg Bacon) writes:

>     my @rules = (
>         ['^HELLO (.*)$', 'BONJOUR $1'],
>     );

It is better to use the natural representation of things.

The 1st element of each rule is natuarally regex.

The 2nd element is natuarally code.

So the natural way to express this is:

     my @rules = (
         [ qr/^HELLO (.*)$/i, sub { "BONJOUR $1" } ],
     );


>         if ($string =~ s/$rule->[0]/'qq{' . $rule->[1] . '}'/eei) {

Using the natural representation this becomes:

>         if ($string =~ s/$rule->[0]/$rule->[1]->()/e) {

Of course you could argue the the natural representation of the whole
rule is simply CODE.

     my @rules = (
        sub{ s/^HELLO (.*)$/BONJOUR $1/i },
     );

    for ( $string ) {
       foreach my $rule (@rules) {
          if ( &$rule ) {
            last;
          }
       }
    }

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Fri, 14 Nov 2003 20:33:51 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Giving back
Message-Id: <20031114152921.65a6706c.jwillmore@remove.adelphia.net>

On 14 Nov 2003 06:49:22 -0800
genericax@hotmail.com (Sara) wrote:

> tadmc@augustmail.com (Tad McClellan) wrote in message
> news:<slrnbr7p2e.lqd.tadmc@magna.augustmail.com>...
> > [Please limit your line lengths to the conventional 70-72
> > characters]
<snip>
> Really Tad, 
> 
>   [Please use a news reader from this century].. 
> 
> This convention arose from punchcards which had, if I recall, 80
> columns, 8 of which were special? I'd like to believe we've
> progressed a bit since then.
> 
> I know traintracks use their width as a legacy handed down from
> Roman Wagons (at least that's the conventional wisdom), but let's
> TRY to be a little more progressive in our industry?

I work on a S390 and use the ISPF editor to edit job cards.  The ISPF
editor only shows 72 characters at a time and makes for really hard
reading when you have to use PF11 to get a lousy 8 characters.

In fact, COBOL (which has been around for a good many years and is
still in use today) *requires* that you not exceed 72 characters for
your code.  Maybe this is where the 8 "special" characters comes from?
 Or maybe it's because COBOL programmers don't want to keep using that
darn PF11 key on a regular basis to read what they coded?  Maybe it's
a combination of both.

Bottom line is this - _we_ don't want to keep scrolling back and forth
to read a message and ask that when you post you limit each line to 72
characters.

To further show *why* we ask this, pull up a few posts off Google. 
Some are nothing more than one *huge* line.  If the person making the
post had followed the 72 character rule, then the post they made would
be more legiable.

But hey, what do I know, right? :-)

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
Every improvement in communication makes the bore more terrible. 
-- Frank Moore Colby 


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

Date: Fri, 14 Nov 2003 20:09:05 +0000 (UTC)
From: stanley@a.shell.peak.org (John Stanley)
Subject: Re: Is a value a decimal number or not?
Message-Id: <bp3cp1$l56$1@a.shell.peak.org>

In article <bp33fu$dka$1@wisteria.csv.warwick.ac.uk>,
Ben Morrow  <usenet@morrow.me.uk> wrote:
>anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:
>> "decimals".  Conceptually, there is no difference between 1 and 1.0.
>
> ... For
>instance, there is no such thing as the '1.0'th element of an array,
>for that would imply that there was also a '1.1'th element, which is
>clearly nonsense.

Furthermore, there is a serious difference in the physical sciences
between 1 and 1.0, as the former says that the measurement was done
to only one significant figure and the latter has two. For the former,
the true value is somewhere between .5 and 1.49+, while for the latter,
the real value is between .95 and 1.049+. The difference is an order
of magnitude.



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

Date: 14 Nov 2003 11:05:49 -0800
From: bl8n8r@yahoo.com (bad_knee)
Subject: regex to convert 1000000 -> 1,000,000 ?
Message-Id: <e817ca4d.0311141105.1cc58788@posting.google.com>

Hello,
I was wondering if anyone had a quick one for "commatizing" a
number in perl? 

Thanks


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

Date: Fri, 14 Nov 2003 20:14:48 +0100
From: Tore Aursand <tore@aursand.no>
Subject: Re: regex to convert 1000000 -> 1,000,000 ?
Message-Id: <pan.2003.11.14.19.14.07.324067@aursand.no>

On Fri, 14 Nov 2003 11:05:49 -0800, bad_knee wrote:
> I was wondering if anyone had a quick one for "commatizing" a
> number in perl? 

This is a FAQ:

  perldoc -q commas


-- 
Tore Aursand <tore@aursand.no>


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

Date: 14 Nov 2003 19:14:14 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: regex to convert 1000000 -> 1,000,000 ?
Message-Id: <u94qx6n4op.fsf@wcl-l.bham.ac.uk>

bl8n8r@yahoo.com (bad_knee) writes:

> I was wondering if anyone had a quick one for "commatizing" a
> number in perl? 

By a strange coincidence, I was wonding if "anyone" ever reads the
FAQ.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 14 Nov 2003 19:48:49 +0000
From: John Rowe <rowe@excc.ex.ac.uk>
Subject: setvbuf broken in Redhat9?
Message-Id: <vnsmkq4tpa.fsf@kenny.ex.ac.uk>


Under RedHat 9 the following simple program:

===========================================================
#! /usr/bin/perl
use FileHandle;
use strict 'vars';
my $mybuffer;

my $fh = new FileHandle ">flubber";

$fh->setvbuf($mybuffer, _IOLBF, 1000);
print $fh "Flubber\n";
===========================================================

Gives the result:
IO::Handle::setvbuf not implemented on this architecture at ./test line 8.

(It works under RH7.3.)

Google (Web+groups) seems to a few posters complaining about this a
year ago but no answers.. Is this really broken on such a major
platform?  Is there anything I can do to work around this?


Thanks

John



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

Date: 14 Nov 2003 21:20:32 GMT
From: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
Subject: Re: setvbuf broken in Redhat9?
Message-Id: <slrnbrahon.bvj.rgarciasuarez@dat.local>

John Rowe wrote in comp.lang.perl.misc :
> 
> Under RedHat 9 the following simple program:
> 
>===========================================================
> #! /usr/bin/perl
> use FileHandle;
> use strict 'vars';
> my $mybuffer;
> 
> my $fh = new FileHandle ">flubber";
> 
> $fh->setvbuf($mybuffer, _IOLBF, 1000);
> print $fh "Flubber\n";
>===========================================================
> 
> Gives the result:
> IO::Handle::setvbuf not implemented on this architecture at ./test line 8.

perl 5.8.0 or later uses (by default) the PerlIO I/O layer instead of
plain raw stdio. For this abstraction layer setvbuf makes no sense.
However this fact was only documented the IO::Handle manpage in perl 5.8.1.


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

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


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