[30606] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1849 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 11 14:09:43 2008

Date: Thu, 11 Sep 2008 11:09:09 -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           Thu, 11 Sep 2008     Volume: 11 Number: 1849

Today's topics:
        binmode blues jidanni@jidanni.org
    Re: binmode blues <brian.d.foy@gmail.com>
    Re: Extract Numeric values from string <rvtol+news@isolution.nl>
    Re: Extract Numeric values from string <fawaka@gmail.com>
    Re: Extract Numeric values from string <ben@morrow.me.uk>
    Re: Extract Numeric values from string <tzz@lifelogs.com>
    Re: Extract Numeric values from string <cartercc@gmail.com>
    Re: Extract Numeric values from string <jurgenex@hotmail.com>
    Re: Extract Numeric values from string xhoster@gmail.com
        I'm struggling with an EZ way to do this regex <buellboy@gmail.com>
    Re: I'm struggling with an EZ way to do this regex <Peter@PSDT.com>
    Re: I'm struggling with an EZ way to do this regex <ben@morrow.me.uk>
    Re: I'm struggling with an EZ way to do this regex <Peter@PSDT.com>
    Re: I'm struggling with an EZ way to do this regex <ben@morrow.me.uk>
        laziest / fastest way to match last characters of a str <blabla@dungeon.de>
    Re: laziest / fastest way to match last characters of a <glex_no-spam@qwest-spam-no.invalid>
    Re: laziest / fastest way to match last characters of a <ben@morrow.me.uk>
    Re: perl upgrade - make test error "Can't locate Config <me2@privacy.net>
    Re: simple perl script for file uploads ? xhoster@gmail.com
    Re: simple perl script for file uploads ? <jack_posemsky@yahoo.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 11 Sep 2008 23:21:10 +0800
From: jidanni@jidanni.org
Subject: binmode blues
Message-Id: <87bpyuoghd.fsf@jidanni.org>

What is wrong with
$ cat normalize
#!/usr/bin/perl
binmode STDIN, ":utf8"; binmode STDOUT, ":utf8";
use Unicode::Normalize q(decompose);
local $/; $_=<>; print decompose($_);

which is causing these to differ?:
$ normalize   4.htm |head -c 11|od -x|head -n 1
0000000 2020 cc61 c282 c280 20a2 0061
$ normalize < 4.htm |head -c 11|od -x|head -n 1
0000000 2020 80e2 20a2 b0e5 e88e 00a6

I.e., why must I remember to use a "<" to get proper results?


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

Date: Thu, 11 Sep 2008 10:31:50 -0700
From: brian d  foy <brian.d.foy@gmail.com>
Subject: Re: binmode blues
Message-Id: <110920081031505967%brian.d.foy@gmail.com>

In article <87bpyuoghd.fsf@jidanni.org>, <jidanni@jidanni.org> wrote:


> which is causing these to differ?:
> $ normalize   4.htm |head -c 11|od -x|head -n 1
> 0000000 2020 cc61 c282 c280 20a2 0061

This one is reading from ARGV. What happens when you bin mode that
filehandle too?

> $ normalize < 4.htm |head -c 11|od -x|head -n 1
> 0000000 2020 80e2 20a2 b0e5 e88e 00a6

This one is reading from STDIN.


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

Date: Thu, 11 Sep 2008 15:07:14 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Extract Numeric values from string
Message-Id: <gabc7e.p8.1@news.isolution.nl>

Dr.Ruud schreef:
> Vishal G:

>> I have string which contain numbers...
>>
>> $str = "30 574 454 67 59 298928 74 4875 8 934"; # in actual string
>> there are 112 million values
>>
>> I would like to extract numveric values from specific position till
>> some position using regular expression.. I dont want to use split
>> caue it uses lot of memory..
>>
>> for example:
>>
>> offset = 3; length = 4;
>>
>> so the result string should be $str = "454 67 59 298928";
>
>
> Maybe you are looking for something like this:
>
> $ perl -Mstrict -Mwarnings -le '
>   print scalar localtime;
>   my $s; $s .= "$_ " for 1..10_000_000;
>   print scalar localtime;
>
>   my $offset = 9_999_903;
>   my $count  =         4;
>
>   while ($s =~ m/([0-9]+)/g) {
>     $count or last;
>     --$offset > 0 and next;
>     $count-- and print $1;
>   }
>   print scalar localtime;
> '
> Thu Sep 11 14:42:40 2008
> Thu Sep 11 14:42:47 2008
> 9999903
> 9999904
> 9999905
> 9999906
> Thu Sep 11 14:42:53 2008

Which means that the while(regexp) skips about 2 million numbers per
second.
So with $offset = 100_000_000 it may take about a minute.

-- 
Affijn, Ruud

"Gewoon is een tijger."



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

Date: 11 Sep 2008 14:02:14 GMT
From: Leon Timmermans <fawaka@gmail.com>
Subject: Re: Extract Numeric values from string
Message-Id: <48c924e6$0$184$e4fe514c@news.xs4all.nl>

On Thu, 11 Sep 2008 01:46:08 -0700, Vishal G wrote:

> Hi there,
> 
> I have searched the whole group looking for solution to my problem.
> 
> Actually, I dont understand the perl regular expression properly...
> working on it...
> 
> Here is the problem..
> 
> I have string which contain numbers...
> 
> $str = "30 574 454 67 59 298928 74 4875 8 934"; # in actual string there
> are 112 million values
> 
> I would like to extract numveric values from specific position till some
> position using regular expression.. I dont want to use split caue it
> uses lot of memory..
> 
> for example:
> 
> offset = 3; length = 4;
> 
> so the result string should be $str = "454 67 59 298928";
> 
> Thanks in advance
> 
> Vishal

Why do you store that in a free-format string? I can think of a a number 
of better ways to store it. You could store it in a binary array (like in 
C) and then access it using vec(). Tie::Array::Packed may also be an 
interesting approach. By storing your data smarter, you can make an O(N) 
algorithm O(1).

Regards,

Leon Timmermans


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

Date: Thu, 11 Sep 2008 14:57:10 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Extract Numeric values from string
Message-Id: <mmknp5-al8.ln1@osiris.mauzo.dyndns.org>


Quoth cartercc <cartercc@gmail.com>:
> On Sep 11, 4:46 am, Vishal G <v3gu...@gmail.com> wrote:
> > I have string which contain numbers...
> >
> > $str = "30 574 454 67 59 298928 74 4875 8 934"; # in actual string
> > there are 112 million values
> >
> > I would like to extract numveric values from specific position till
> > some position using regular expression.. I dont want to use split caue
> > it uses lot of memory..
> >
> > for example:
> >
> > offset = 3; length = 4;
> >
> > so the result string should be $str = "454 67 59 298928";
> 
> Is your string already in memory, or does it come from storage? If the
> latter, you might consider replacing the spaces with new lines and
> then using a counter to iterate through the file with something like
> this:
> 
> while (<INFILE>)

No need to replace the spaces. $/ = " " will work just fine.

<snip>
> If your string is already in memory, I would use the C trick of getc()

getc reads from a file, not from memory.

Ben

-- 
You poor take courage, you rich take care:
The Earth was made a common treasury for everyone to share
All things in common, all people one.
'We come in peace'---the order came to cut them down.       [ben@morrow.me.uk]


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

Date: Thu, 11 Sep 2008 09:25:17 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Extract Numeric values from string
Message-Id: <86fxo6wyia.fsf@lifelogs.com>

On Thu, 11 Sep 2008 01:46:08 -0700 (PDT) Vishal G <v3gupta@gmail.com> wrote: 

VG> Here is the problem..

VG> I have string which contain numbers...

VG> $str = "30 574 454 67 59 298928 74 4875 8 934"; # in actual string
VG> there are 112 million values

VG> I would like to extract numveric values from specific position till
VG> some position using regular expression.. I dont want to use split caue
VG> it uses lot of memory..

This works for me.  To avoid dealing with edge cases, I surround the
input with spaces.  The assumption is that only digits and spaces are in
your data; the algorithm uses that to find the next space or the next
digit.  Note also that slow_extract() is there as a reference to check
the algorithm works OK.  It's very possible it has bugs: I wrote it to
show you the general idea of iterating through the string, and tests are
what you see in __DATA__ which is minimal.

You should consider keeping large data sets like this in a database,
e.g. SQLite.  Then operating on it from Perl or other languages is much
easier, especially if you index your columns appropriately.

Ted

#!/usr/bin/perl

use warnings;
use strict;
use Data::Dumper;
use List::Util qw/min/;

my $str = <DATA>; # we keep it global so it's not passed around
chomp $str;
$str = " $str ";


while (<DATA>)
{
 my ($pos, $offset) = m/(\d+)\D+(\d+)/;
 my $slow_result = slow_extract($pos, $offset);
 my $fast_result = fast_extract($pos, $offset);
 my $ok = $slow_result eq $fast_result;
 print "position $pos, offset $offset: $slow_result / $fast_result / OK=$ok\n";
}

sub slow_extract
{
 my $logical_pos = shift @_;
 my $n 	 	 = shift @_;

 my @numbers = split ' ', $str;
 return join ' ', grep { defined } @numbers[$logical_pos .. $logical_pos+$n-1];
}

sub fast_get_number
{
 my $start_pos    = shift @_;

 my @matches = grep { defined && $_ > 0 } map { index($str, $_, $start_pos) } 0..9;

 return unless scalar @matches;
 
 my $start = min(@matches);
 my $end = index($str, ' ', $start);
 return ($end, substr($str, $start, $end-$start));
}

sub fast_extract
{
 my $logical_pos = shift @_;
 my $n    	 = shift @_;

 my $at = 0;
 my $current_logical_pos = 0;

 my @numbers;
 while (1)
 {
  my @next = fast_get_number($at);
  print Dumper \@next;
  last unless scalar @next;
  last if $next[0] < 0;
  if ($current_logical_pos >= $logical_pos)
  {
   push @numbers, $next[1];
  }
  $at = $next[0];
  last if scalar @numbers == $n;
  $current_logical_pos++;
 }

 return join ' ', @numbers;
}

__DATA__
93430 574 454 67 59 298928 74 4875 8 93430
3 4
5 6
7 8
10 2


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

Date: Thu, 11 Sep 2008 07:29:17 -0700 (PDT)
From: cartercc <cartercc@gmail.com>
Subject: Re: Extract Numeric values from string
Message-Id: <a1b74362-2031-430c-acfa-00d825019a2f@k37g2000hsf.googlegroups.com>

This is why I read this group, always learning things at the (small)
cost of exhibiting my own ignorance. It always amazes me the depth of
knowledge that some people have, and a little bit depressing as to my
own lack of knowledge.

I have several friends who are medical doctors, and know several of
their children who are in various stages of the medical education
process, and I've always liked that approach: two years in the
classroom and four (or more) in the field. In a job you get stuck in a
rut where you might have the same experience thousands of times,
unlike a forum like c.l.p.m. where you can broaden your knowledge by
way of specific, limited example.

All this as a rather wordy 'Thanks'.

CC

On Sep 11, 9:57=A0am, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth cartercc <carte...@gmail.com>:
>
>
>
> > On Sep 11, 4:46=A0am, Vishal G <v3gu...@gmail.com> wrote:
> > > I have string which contain numbers...
>
> > > $str =3D "30 574 454 67 59 298928 74 4875 8 934"; # in actual string
> > > there are 112 million values
>
> > > I would like to extract numveric values from specific position till
> > > some position using regular expression.. I dont want to use split cau=
e
> > > it uses lot of memory..
>
> > > for example:
>
> > > offset =3D 3; length =3D 4;
>
> > > so the result string should be $str =3D "454 67 59 298928";
>
> > Is your string already in memory, or does it come from storage? If the
> > latter, you might consider replacing the spaces with new lines and
> > then using a counter to iterate through the file with something like
> > this:
>
> > while (<INFILE>)
>
> No need to replace the spaces. $/ =3D " " will work just fine.
>
> <snip>
>
> > If your string is already in memory, I would use the C trick of getc()
>
> getc reads from a file, not from memory.
>
> Ben
>
> --
> You poor take courage, you rich take care:
> The Earth was made a common treasury for everyone to share
> All things in common, all people one.
> 'We come in peace'---the order came to cut them down. =A0 =A0 =A0 [b...@m=
orrow.me.uk]



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

Date: Thu, 11 Sep 2008 08:13:05 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Extract Numeric values from string
Message-Id: <aqcic491905flqnukbt87v8l4dvsl3lf68@4ax.com>

Vishal G <v3gupta@gmail.com> wrote:
>I have string which contain numbers...
>
>$str = "30 574 454 67 59 298928 74 4875 8 934"; # in actual string
>there are 112 million values

Wow! A single string of maybe half a gigabyte length? That sounds like
an awfully poor datastructure.

>I would like to extract numveric values from specific position till
>some position using regular expression.. I dont want to use split caue
>it uses lot of memory..

I cannot imagine that REs will be any more efficient than split(), which
uses REs, BTW, too.

>for example:
>
>offset = 3; length = 4;
>
>so the result string should be $str = "454 67 59 298928";

I would put that data into a more suitable data structure. 
Maybe write the string to a file and then read it back into an array
using the space character as the line separator?

Or loop through the string character by character and note all positions
of space characters in an array. Then you can use substr() to extract
the desired substring directly.

jue


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

Date: 11 Sep 2008 17:44:14 GMT
From: xhoster@gmail.com
Subject: Re: Extract Numeric values from string
Message-Id: <20080911134416.345$a4@newsreader.com>

Jürgen Exner <jurgenex@hotmail.com> wrote:
> Vishal G <v3gupta@gmail.com> wrote:
> >I have string which contain numbers...
> >
> >$str = "30 574 454 67 59 298928 74 4875 8 934"; # in actual string
> >there are 112 million values
>
> Wow! A single string of maybe half a gigabyte length? That sounds like
> an awfully poor datastructure.

Yes.  But Perl is often used as a glue language.  As such, it often has
to deal with poor datastructures.  If the other programs could be easily
changed to do the right thing in the first place, we wouldn't need the
glue.

 ...
>
> I would put that data into a more suitable data structure.
> Maybe write the string to a file and then read it back into an array
> using the space character as the line separator?

That would use at least half as much memory as splitting, and so would
probably be memory prohibitive.

> Or loop through the string character by character and note all positions
> of space characters in an array. Then you can use substr() to extract
> the desired substring directly.

If this only has to be done once per execution, then I would just leave it
in the original structure and step though it with /(\d+)/g.  If I was going
to do several extractions, I would convert the string so that each element
is fixed size (either by padding the numbers with 0 to the max length, or
by using pack with the appropriate template) then use substr to get the
desired chunk.

while ($str=~/(\d+)/g) {$y.=pack "i", $1};

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.


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

Date: Thu, 11 Sep 2008 06:43:04 -0700 (PDT)
From: "advice please wireless 802.11 on RH8" <buellboy@gmail.com>
Subject: I'm struggling with an EZ way to do this regex
Message-Id: <c1d4f8d3-a619-4dc9-9432-86581503ab97@d45g2000hsc.googlegroups.com>

I'm pretty good at regexes- at least for most common uses. But
although I can brute force a solution here I'm not happy with it!

Lets say we have an array like

    my @a = qw(10 20 22 23 25);

and some text like

   '44,33,4.44.64.10,32,25,88,20,6,55'

and I want a regex that replaces any number in the string with say
'XX', as long as that number is not in the array @a, yielding:

    $_ = 'XX,XX,XX.XX.XX.10,XX,25,XX,20,XX,XX'

The most *elegant* approach I've dreamed up is to join the array with
OR (|), then somehow use that to compare in the text. But I'm not sure
how to negatively compare.

my $a = join '|',@a;
s/(something)($a)/XXX/g;

I think this may be one of those oddball assertions that I never
mastered.

My other idea was to @t = split /,/
then iterate over each element with

   grep /^$element$/,@t

but that ain't so pretty either..



Can someone give me a nudge in the right direction to do this in A
single, simple, elegant regex with no array conversions or looping? I
can usually dream one up but not this time!


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

Date: Thu, 11 Sep 2008 14:12:14 GMT
From: Peter Scott <Peter@PSDT.com>
Subject: Re: I'm struggling with an EZ way to do this regex
Message-Id: <pan.2008.09.11.14.12.13.917976@PSDT.com>

On Thu, 11 Sep 2008 06:43:04 -0700, advice please wireless 802.11 on RH8
wrote:
> Lets say we have an array like
> 
>     my @a = qw(10 20 22 23 25);
> 
> and some text like
> 
>    '44,33,4.44.64.10,32,25,88,20,6,55'
> 
> and I want a regex that replaces any number in the string with say
> 'XX', as long as that number is not in the array @a, yielding:
> 
>     $_ = 'XX,XX,XX.XX.XX.10,XX,25,XX,20,XX,XX'

my @a = qw(10 20 22 23 25);
$_ = '44,33,4.44.64.10,32,25,88,20,6,55';
my %keep = map { $_, 1 } @a;
s/(\d+)/$keep{$1} ? $1 : 'XX'/ge;

-- 
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/



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

Date: Thu, 11 Sep 2008 15:16:08 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: I'm struggling with an EZ way to do this regex
Message-Id: <8qlnp5-1d9.ln1@osiris.mauzo.dyndns.org>


Quoth "advice please wireless 802.11 on RH8" <buellboy@gmail.com>:
> I'm pretty good at regexes- at least for most common uses. But
> although I can brute force a solution here I'm not happy with it!
> 
> Lets say we have an array like
> 
>     my @a = qw(10 20 22 23 25);
> 
> and some text like
> 
>    '44,33,4.44.64.10,32,25,88,20,6,55'
> 
> and I want a regex that replaces any number in the string with say
> 'XX', as long as that number is not in the array @a, yielding:
> 
>     $_ = 'XX,XX,XX.XX.XX.10,XX,25,XX,20,XX,XX'
> 
> The most *elegant* approach I've dreamed up is to join the array with
> OR (|), then somehow use that to compare in the text. But I'm not sure
> how to negatively compare.
> 
> my $a = join '|',@a;
> s/(something)($a)/XXX/g;
> 
> I think this may be one of those oddball assertions that I never
> mastered.

Something like

    s/ (?! $a ) \d+ /XX/gx

is what you want, but that hits lots of nasty corner cases like '1'
being in the array and '12' in the string. I *think*

    s/ (^|\D) (?! (?: $a) (?: \D|$) ) \d+ /$1XX/gx

works correctly, but that's hardly pretty. With 5.10 you can remove the
nasty $1 capture using \K:

    s/ (?: ^|\D) \K (?! (?: $a) (?: \D|$) ) \d+ /XX/gx

but it's not much of an improvement.

I would put the numbers to be matched in a hash:

    my %ok;
    @ok{@a} = 1;

and then split the string and match against the hash:

    my @split = split /\D/;
    for (@split) {
        $_ = "XX" unless $ok{$_};
    }
    $_ = join ",", @split;

Ben

-- 
I have two words that are going to make all your troubles go away.
"Miniature". "Golf".
                                                         [ben@morrow.me.uk]


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

Date: Thu, 11 Sep 2008 14:26:31 GMT
From: Peter Scott <Peter@PSDT.com>
Subject: Re: I'm struggling with an EZ way to do this regex
Message-Id: <pan.2008.09.11.14.26.28.389875@PSDT.com>

On Thu, 11 Sep 2008 15:16:08 +0100, Ben Morrow wrote:
> I would put the numbers to be matched in a hash:
> 
>     my %ok;
>     @ok{@a} = 1;
> 
> and then split the string and match against the hash:
> 
>     my @split = split /\D/;
>     for (@split) {
>         $_ = "XX" unless $ok{$_};
>     }
>     $_ = join ",", @split;

Not all of the inter-digit characters in the input string were commas.

-- 
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/



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

Date: Thu, 11 Sep 2008 15:39:32 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: I'm struggling with an EZ way to do this regex
Message-Id: <46nnp5-k3a.ln1@osiris.mauzo.dyndns.org>


Quoth Peter Scott <Peter@PSDT.com>:
> On Thu, 11 Sep 2008 15:16:08 +0100, Ben Morrow wrote:
> > I would put the numbers to be matched in a hash:
> > 
> >     my %ok;
> >     @ok{@a} = 1;
> > 
> > and then split the string and match against the hash:
> > 
> >     my @split = split /\D/;
> >     for (@split) {
> >         $_ = "XX" unless $ok{$_};
> >     }
> >     $_ = join ",", @split;
> 
> Not all of the inter-digit characters in the input string were commas.

I noticed that, but the OP mentioned split /,/ so I presumed they were
typos. If not, something like

    my @split = split /(\D+)/;
    for (@split) {
        /\D/ and next;
        $_ = "XX" unless $ok{$_};
    }
    $_ = join "", @split;

should do.

Ben

-- 
   If you put all the prophets,   |   You'd have so much more reason
   Mystics and saints             |   Than ever was born
   In one room together,          |   Out of all of the conflicts of time.
ben@morrow.me.uk                                    The Levellers, 'Believers'


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

Date: Thu, 11 Sep 2008 09:00:41 -0700 (PDT)
From: hofer <blabla@dungeon.de>
Subject: laziest / fastest way to match last characters of a string
Message-Id: <ce170129-c0f6-436f-90a0-12f54a0da42d@l43g2000hsh.googlegroups.com>

Hi,
Let's look at following example:

$text = "Today is a nice day";
$end = "day";

print "text ends with $end" if $text =~ /$end$/;

Would the regular expression be efficient for long strings?

The alternative is a little more awkward to type

print "text ends with $end"  substr($text,-length($end)) eq $end;  # I
didn't try this line, but it should work I think

Is there any core module containing something like
print "text ends with $end" if endswith($text,$end);


thans and bye


H


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

Date: Thu, 11 Sep 2008 11:06:50 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: laziest / fastest way to match last characters of a string
Message-Id: <48c9421a$0$89389$815e3792@news.qwest.net>

hofer wrote:
> Hi,
> Let's look at following example:
> 
> $text = "Today is a nice day";
> $end = "day";
> 
> print "text ends with $end" if $text =~ /$end$/;
> 
> Would the regular expression be efficient for long strings?

Why not benchmark some different alternatives to see?  Your 'long 
strings' might not be all that long.

> 
> The alternative is a little more awkward to type
> 
> print "text ends with $end"  substr($text,-length($end)) eq $end;  # I
> didn't try this line, but it should work I think
> 
> Is there any core module containing something like
> print "text ends with $end" if endswith($text,$end);

Don't know if it'll be faster, but using length and index would be an 
alternative, another would be substr.

perldoc -f index
perldoc -f length
perldoc -f substr


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

Date: Thu, 11 Sep 2008 17:23:27 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: laziest / fastest way to match last characters of a string
Message-Id: <v8tnp5-kme.ln1@osiris.mauzo.dyndns.org>


Quoth hofer <blabla@dungeon.de>:
> 
> $text = "Today is a nice day";
> $end = "day";
> 
> print "text ends with $end" if $text =~ /$end$/;
> 
> Would the regular expression be efficient for long strings?

    ~% perl -Mre=debug -e'$end="day"; "Today is a nice day" =~ /$end$/'  
    Freeing REx: `","'
    Compiling REx `day$'
    size 4 Got 36 bytes for offset annotations.
    first at 1
       1: EXACT <day>(3)
       3: EOL(4)
       4: END(0)
    anchored "day"$ at 0 (checking anchored isall) minlen 3 
    Offsets: [4]
            1[3] 0[0] 4[1] 5[0] 
    Guessing start of match, REx "day$" against "Today is a nice day"...
    Found anchored substr "day"$ at offset 16...
    Starting position does not contradict /^/m...
    Guessed: match at offset 16
    Freeing REx: `"day$"'

The first thing it tries is a direct match against the last three
characters, which is as fast as it gets.

Ben

-- 
                Outside of a dog, a book is a man's best friend.
                Inside of a dog, it's too dark to read.
ben@morrow.me.uk                                                  Groucho Marx


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

Date: Thu, 11 Sep 2008 16:16:59 +0100
From: "Lee Stone" <me2@privacy.net>
Subject: Re: perl upgrade - make test error "Can't locate Config_heavy.pl"
Message-Id: <48c9366e$0$2507$da0feed9@news.zen.co.uk>


"sisyphus" <sisyphus359@gmail.com> wrote in message 
news:00aaab18-b1af-4608-812a-b61b8d809554@a18g2000pra.googlegroups.com...
>On Sep 11, 9:47 am, "Lee Stone" <m...@privacy.net> wrote:
>> Hello
>>
> >Although I have seen a couple of other people with similar errors, I 
> >cannot
> >find any solutions.
>
>Looks like some sort of bug in the test suite.
>
>See 
>http://www.nntp.perl.org/group/perl.perl5.porters/2008/04/msg135950.html
>. Assuming that fix results in all t/op/filetest.t tests passing, then
>you've got nothing to worry about.
>
>Mind you, having read that post, I still don't see why it should be
>necessary to go to that trouble to get filetest.t to run properly.
>Afaict, things should work perfectly well the way they are ... but
>they obviously don't. (I don't have access to a machine that can
>reproduce your problem.)

Have re-read the post to which you refer. First time round got a bit lost - 
I thought this was a hack to get round the error as opposed to a fix (if you 
see what I mean)

Many thanks. I appreciate the help.

L 



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

Date: 11 Sep 2008 16:01:24 GMT
From: xhoster@gmail.com
Subject: Re: simple perl script for file uploads ?
Message-Id: <20080911120125.614$y3@newsreader.com>

Jack <jack_posemsky@yahoo.com> wrote:
> Hi I am looking for a NON form based simple script that handles a file
> upload on the server side.

So of the N possible user interfaces, where N is a very large number,
perhaps infinite, you are willing to work with any of the N-1 of them?

I think a better approach is to define what you want, not what you don't
want.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.


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

Date: Thu, 11 Sep 2008 10:44:03 -0700 (PDT)
From: Jack <jack_posemsky@yahoo.com>
Subject: Re: simple perl script for file uploads ?
Message-Id: <175898c4-39d3-451d-bb59-1de2d17d44ee@c22g2000prc.googlegroups.com>

On Sep 11, 9:01=A0am, xhos...@gmail.com wrote:
> Jack <jack_posem...@yahoo.com> wrote:
> > Hi I am looking for a NON form based simple script that handles a file
> > upload on the server side.
>
> So of the N possible user interfaces, where N is a very large number,
> perhaps infinite, you are willing to work with any of the N-1 of them?
>
> I think a better approach is to define what you want, not what you don't
> want.
>
> Xho
>
> --
> --------------------http://NewsReader.Com/--------------------
> The costs of publication of this article were defrayed in part by the
> payment of page charges. This article must therefore be hereby marked
> advertisement in accordance with 18 U.S.C. Section 1734 solely to indicat=
e
> this fact.

I want to add the ability to post a file from a browser to a server.
Example is craigslist where the user selects an image file and uploads
it to their servers. Thats it, its very simple and preferably not via
a form post since I am using that already with my ajax code thats
populating my HTML + perl logic into a form, and its advisable to only
post to one form, not more than 1.

Thank you,

Jack


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

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 V11 Issue 1849
***************************************


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