[28621] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9985 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 20 06:06:01 2006

Date: Mon, 20 Nov 2006 03:05:07 -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           Mon, 20 Nov 2006     Volume: 10 Number: 9985

Today's topics:
    Re: '\0' like in C <jurgenex@hotmail.com>
    Re: '\0' like in C <robertospara@gmail.com>
    Re: '\0' like in C <wahab-mail@gmx.de>
    Re: Add numbers in a string <john@castleamber.com>
    Re: Add numbers in a string <abigail@abigail.be>
    Re: Add numbers in a string <wahab-mail@gmx.de>
        Dao language 1.0 beta is release! <phoolimin@gmail.com>
    Re: Do U use >>>>>perl -e 'use re debug;/REGEX/' so U c <robertospara@gmail.com>
    Re: Do U use >>>>>perl -e 'use re debug;/REGEX/' so U c <wahab-mail@gmx.de>
    Re: FAQ 7.17 How can I access a dynamic variable while  <rkrause@searstower.org>
    Re: Fetching input character without newline? <robertospara@gmail.com>
        How to change Perl's concept of a newline in regexps? <rkrause@searstower.org>
    Re: How to change Perl's concept of a newline in regexp <robertospara@gmail.com>
    Re: How to change Perl's concept of a newline in regexp <nospam-abuse@ilyaz.org>
    Re: How to compress a big file into many zip files with <struggle@mail.nankai.edu.cn>
    Re: How to compress a big file into many zip files with <struggle@mail.nankai.edu.cn>
        new CPAN modules on Mon Nov 20 2006 (Randal Schwartz)
    Re: Perl is worth nothing!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! <rkrause@searstower.org>
    Re: Perl is worth nothing!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! <bugbear@trim_papermule.co.uk_trim>
    Re: Perl is worth noting! <bol@adv.magwien.gv.at>
    Re: print to terminal <alexxx.magni@gmail.com>
        Win32::Registry::File - update values in file <lev.weissman@creo.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 20 Nov 2006 06:27:46 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: '\0' like in C
Message-Id: <CVb8h.3505$IW2.816@trndny03>

robertospara wrote:
> Question to Tad McLellan:
> Is there something in Perl like '\0' in C?

You mean a character with all bits zero? Yes, there is.

> ???????

Your keyboard needs some repairs.

> U seams to be smart????????

Who/what is U?

> So??????????????????????????????

Your keyboard needs some serious repairs.

jue 




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

Date: 20 Nov 2006 00:02:33 -0800
From: "robertospara" <robertospara@gmail.com>
Subject: Re: '\0' like in C
Message-Id: <1164009753.011156.302980@h48g2000cwc.googlegroups.com>

But for me '\0' is the mark of the end of the array (or string we can
say when the type is char).
So when I have >>>$string =3D "abcd"<<< is there somewhere '\0' in the
end???????????????????
Ex.
char a[10] =3D "abcd";
and then we have
a[0] =3D 'a' a[1]=3D'b' a[2]=3D'c' a[3]=3D'd'
>>>>>>>>>>>>>a[4]=3D'\0'<<<<<<<<<<<<<<<<<<<

>>>>>>>>>>>>>a[4]=3D'\0'<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>a[4]=3D'\0'<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>a[4]=3D'\0'<<<<<<<<<<<<<<<<<<<
So this is what I am talking about.
Greetings to all:)
J=FCrgen Exner napisal(a):
> robertospara wrote:
> > Question to Tad McLellan:
> > Is there something in Perl like '\0' in C?
>
> You mean a character with all bits zero? Yes, there is.
>
> > ???????
>
> Your keyboard needs some repairs.
>
> > U seams to be smart????????
>
> Who/what is U?
>
> > So??????????????????????????????
>=20
> Your keyboard needs some serious repairs.
>=20
> jue



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

Date: Mon, 20 Nov 2006 09:36:37 +0100
From: Mirco Wahab <wahab-mail@gmx.de>
Subject: Re: '\0' like in C
Message-Id: <ejrpni$8jv$1@mlucom4.urz.uni-halle.de>

robertospara schrieb:
> Question to Tad McLellan:
> Is there something in Perl like '\0' in C????????

No.

No if you mean '\0' as a "signal"
for string library functions.

This is mainly because a "string" (scalar) "$text"
in perl isn't the address of the character array
(as in C) but its a pointer to a structure which
contains (among others) the address of this
character array in question.

In C, you have a "string" concept that uses
an extra character (\0) at the end of the data,
in Perl you have an extra integer at another
place in the said struct which says how long
it is.

Regards

Mirco


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

Date: 20 Nov 2006 05:41:54 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Add numbers in a string
Message-Id: <Xns9880F1118C34Dcastleamber@130.133.1.4>

"DJ Stunks" <DJStunks@gmail.com> wrote:

> John Bokma wrote:
>> use strict;
>> use warnings;
>>
>> my $string = 'test 34bob 232 frank 1';
>> my $sum = 0;
>> # add numbers to the sum while we find numbers in the string
>> $sum += $1 while $string =~ /(\d+)/g;
>> print "$sum\n";
>>
>> C:\Documents and Settings\John\My Documents>sum.pl
>> 267
> 
> no need to capture in the regex.

Use of uninitialized value in addition (+) at C:\Documents and Settings
\John\My Documents\sum.pl line 6.
Use of uninitialized value in addition (+) at C:\Documents and Settings
\John\My Documents\sum.pl line 6.
Use of uninitialized value in addition (+) at C:\Documents and Settings
\John\My Documents\sum.pl line 6.
0

I guess you mean that:

> and how about adding them all up at
> once?

:-D. After posting the "while version" I thought, maybe nice for a blog 
entry, and maybe another example using List::Util would be cool...

-- 
John                Experienced Perl programmer: http://castleamber.com/

          Perl help, tutorials, and examples: http://johnbokma.com/perl/


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

Date: 20 Nov 2006 06:32:53 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: Add numbers in a string
Message-Id: <slrnem2ivh.bt.abigail@alexandra.abigail.be>

Mirco Wahab (wahab@chemie.uni-halle.de) wrote on MMMMDCCCXXIX September
MCMXCIII in <URL:news:ejqv8l$18p$1@mlucom4.urz.uni-halle.de>:
][  Thus spoke Abigail (on 2006-11-20 01:47):
][ > abbyhoffman@gmail.com (abbyhoffman@gmail.com) wrote on MMMMDCCCXXVIII
][ > September MCMXCIII in <URL:news:1163964540.131345.221880@j44g2000cwa.googlegroups.com>:
][ > ^^  Hello,
][ > ^^  
][ > ^^  I'm a complete Perl newb, but I was wondering if there was a way to add
][ > ^^  the numbers in a string together.  Ie
][ > ^^  
][ > ^^  test 34bob 232 frank 1 
][ > ^^  
][ > ^^  would add 34 + 232 + 1 to get 267
][ > 
][ > 
][ >     my $str = '34 + 232 + 1';
][ >     my @num = $str =~ /\d+/g;
][ >     $" = " + ";
][ >     print eval "@num";
][  
][  Nice Idea!
][  
][  but much too verbose (;-)
][  
][     $" = " + ";
][     print eval "@$_" for [$string =~ /\d+/g];


       $" = " + "
       $_ = "34 + 232 + 1";
       print eval "@{[/\d+/g]}";


Abigail
-- 
:$:=~s:$":Just$&another$&:;$:=~s:
:Perl$"Hacker$&:;chop$:;print$:#:


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

Date: Mon, 20 Nov 2006 09:23:31 +0100
From: Mirco Wahab <wahab-mail@gmx.de>
Subject: Re: Add numbers in a string
Message-Id: <ejrov0$8bs$1@mlucom4.urz.uni-halle.de>

Abigail wrote:
> Mirco Wahab (wahab@chemie.uni-halle.de) wrote on MMMMDCCCXXIX September
> ][  Thus spoke Abigail (on 2006-11-20 01:47):
> ][ >     my $str = '34 + 232 + 1';
> ][ >     my @num = $str =~ /\d+/g;
> ][ >     $" = " + ";
> ][ >     print eval "@num";
> ][  
> ][  Nice Idea!
> ][  
> ][  but much too verbose (;-)
> ][  
> ][     $" = " + ";
> ][     print eval "@$_" for [$string =~ /\d+/g];
> 
> 
>        $" = " + "
>        $_ = "34 + 232 + 1";
>        print eval "@{[/\d+/g]}";


WTF.

I  didn't expect sth. like that would work.

(It does.)

Regrds & thanks for this one.

Mirco


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

Date: 20 Nov 2006 02:43:02 -0800
From: "fulimin" <phoolimin@gmail.com>
Subject: Dao language 1.0 beta is release!
Message-Id: <1164019382.245806.4020@b28g2000cwb.googlegroups.com>

Hello,

After a few months' effort, I have finished the implementation of Dao
Virtual Machine(DVM), and released it as 1.0-beta. The DVM is
implemented as a very efficient virtual register machine. This version
has implemented all the features I have planned. Most importantly, the
implementation has been switched from C++ to standard C. As a
consequence, the binary code of DVM is much smaller than before (as
executable 250KB, as dynamic linking library 300KB, linux/gcc4). The
efficiency has also been improved as well. The structure of DVM has
been changed slightly, such that the embedding and extending of DVM
becomes more convinient. In fact, now the mechanism to call internal
functions is exactly the same as the mechanism to call extended
functions. To allow DVM being more freely used, GLPL (GNU Lesser
General Public Licence) has been adopted since this release. The DVM
can be compiled and run in both windows and linux, but so far, it is
tested mainly under linux. As before, the documentation of Dao is not
well prepared yet; and there are only a few extended modules available
for using. These two things will be the prioritized work in the near
future.

links:
website: http://www.xdao.org
documentations: http://www.xdao.org/daoweb.dao?page=3Ddocument

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Changed or new features
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

-----
Multiple lines comment: <<<...>>> is changed to #{...#}, which can be
used anywhere in the scripts.

-----
Built-in functions have been organized into some basic libraries:
stdlib, stdio, math, reflect, coroutine, thread etc. So now Built-in
function xyz(...) should be used abc.xyz(...), where "abc" is the
proper library. For convinience and efficiency, one may also do:
xyz =3D abc.xyz;
xyz(...);

-----
More methods are added for basic data types;

-----
Bit operations |, &, ^, ~, <<, >>;

-----
Typed variables, assignment between variable of different types will
issure an error:

a : 1; # a is a number; not compiled virtual instruction;
a :=3D 1; # a is a number; compiled into assignment instruction;

The right side of : or :=3D must be a const. This kind of syntax is for
consistence with syntax for specifying typed parameters in function
definition;

-----
Similarly class may have typed instance variables. Moreover, "my a :=3D
1" will also specify the default value for the variable;

-----
Class instance creation by enumeration:
class MyNumber
    my value :=3D 0;
end

num1 =3D MyNumber{ 123 };

num2 =3D MyNumber {
    value @=3D 456; # may specify the name of variables to be
initialized.
};

Be cautious when enumerating class members without speficying names
to create class instances for derived classes.

-----
Creating multi-dimensional array:

changed from
list =3D { 2, 3 } : 100;
array =3D [ 2, 3 ] : 100; # 2 X 3 matrix
to
list =3D 100 <@> { 2, 3 };
array =3D 100 <@> [ 2, 3 ];

operator <@> can be called arrange operator. A<@>B, arrange A or copies
of A into a list or array of shape B. If B is a list, this operator
will create a new list which has shape specified by B, and contains A
or copies of A as elements. If B is a numeric array, this operator will
create a numeric array with shape B; if A is also a numberic array, the
resulting array will contain multiple subarrays that are equal to A.

This new operator is introduce because the previous using colon for
multiple purpose is confusing.

-----
Support coroutines similar to Lua coroutines;

-----
Previous built-in functions sort(),apply(),noapply() have become
methods of list
or numeric array with some changing in syntax:

before:
sort( list, @0 < @1, n );
now:
list.sort( @{ @0 < @1 }, n );
before=A3=BA
apply( array[ 1:5, : ], @0 + @1 * @2 );
now:
array.apply( @{ @0 + @1 * @2 }, { 1:5, : } );

Expressions that are used as parameters should be put inside @{ }. The
advantage for this is,
simpler parsing; and moreover, they can be passed to C extending
functions.

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Extending modules:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
New modules available:
- DaoCGI: CGI web programming;
- DaoFastCGI: FastCGI web programming;allow DVM to run as FastCGI
server;
- DaoSqlite: binding to Sqlite3 database; lighttpd +sqlite +dao could
be a good option
             for some websites, since each of them is designed to be
light and efficient.
- DaoOpenGL: 3D graphics; support upto DaoOpenGL1.1=A3=ACincluding GLU;
- DaoSDL: binding to Single DirectMedia Layer, partially finished;
- DaoCamellia: binding to camellia image processing library;

The previous modules DaoMySQL, DaoBLAS and DaoPython are not yet
upgraded accordingly for this release.

Have fun!

Limin Fu
phoolimin[AT]gmail[DOT]com



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

Date: 20 Nov 2006 00:05:32 -0800
From: "robertospara" <robertospara@gmail.com>
Subject: Re: Do U use >>>>>perl -e 'use re debug;/REGEX/' so U can help??
Message-Id: <1164009931.939458.191800@b28g2000cwb.googlegroups.com>

So MONKS OF THE PERL
???????????????????????????????????????????????????????
Are you still
ALIVE?????????????????????????????????????????????????????????????

On 20 Lis, 04:28, "robertospara" <robertosp...@gmail.com> wrote:
> Secret of offsets:
>                 A(BC?(DE)*)+F    - sample of regex
>                          |        |   |
>
>         Comment: Offsets include information about fingered ends of the
> sub-regexen, as U can see above:
>
>         Offsets: [29]
>         1[1] 0[0] 12[1] 0[0] 2[1] 0[0] 3[1] 0[0] 5[1] 0[0] 4[1] 0[0]
> 10[1] 0[0] 6[1] 0[0] 7[2] 0[0] 9[1] 0[0] 10[0] 10[0]
>                          +             (                          ?
>         C            *             (
>                         %%%%%%                        %%%%%%
> %%%%%
>
>         11[1] 0[0] 12[0] 12[0] 13[1] 0[0] 14[0]
>
>          t.b.c. but about beginnings too but in reverse queue. So firse
> end of su-regex ( with additional quantifier ), then later first next
> not-null, this one is the beginning of this sub-regex.
> In this way that I would like to show above with bushes of %%%%%
> precentages.
>
> So if the first offset or first not-null from left is like position[
> length] and position >1 so this is
> offset that tells about position of the end of firs subregex in global
> regex.
> So next not-null after this is the position of the begining of this
> sub-regex. Mostly position of
> the beginning of global regex.
>
> Ad. I made this "perl -e 'use re debug;/A(BC?(DE)*)+F/'".
>         So compiled regex looks like this:
>  Compiling REx `A(BC?(DE)*)+F'
>  size 29 Got 236 bytes for offset annotations.
>  first at 1
>    1: EXACT <A>(3)
>    3: CURLYX[0] {1,32767}(26)
>    5:   OPEN1(7)
>    7:     EXACT <B>(9)
>    9:     CURLY {0,1}(13)
>   11:       EXACT <C>(0)
>   13:     CURLYM[2] {0,32767}(23)
>   17:       EXACT <DE>(21)
>   21:       SUCCEED(0)
>   22:       NOTHING(23)
>   23:   CLOSE1(25)
>   25:   WHILEM[1/2](0)
>   26: NOTHING(27)
>   27: EXACT <F>(29)
>   29: END(0)
>  anchored "AB" at 0 floating "F" at 2..2147483647 (checking anchored)
> minlen 3
>
> On 20 Lis, 04:09, "robertospara" <robertosp...@gmail.com> wrote:
>
> > Hi.
> > I am involved in work under project that will visualize the process of
> > matching the regex to input text.
> > As data to highlight sub-regexes which take a part in each step of
> > matching I want to use perl debugger output from regex compilation (
> > perl -e '-re debug; $text =~/regex/'). In the doc file perldebguts is
> > very  less information about subregexes position in regex that are
> > already use in matching process. If someone every wanted to do that
> > could have said the same. My question: Eny ideas to get out from
> > debugger output elements that I could highlight in each step to
> > visualize matching process.
>
> > My last idea was that I could take from offsets (look in perldebguts if
> > don't know what I mean) the position where sub-regex is ending for
> > example :
>
> >     my_regex == son((mother)?father*)+daughter
>
> >                                                  |           |  |
>
> >                                                 13      20   22
> > So positions 13, 20, 22 I receive from debugger. Then I should write
> > parser of my regex to get positions  :
> >  - beginning of sub-regex "(mother)?"
> >  - beginning of sub-regex "father*"
> >  - beginning of sub-regex "((mother)?father*)+".
>
> > I don't see for now any other way. Any clues nice welcome. Best regards.



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

Date: Mon, 20 Nov 2006 10:43:09 +0100
From: Mirco Wahab <wahab-mail@gmx.de>
Subject: Re: Do U use >>>>>perl -e 'use re debug;/REGEX/' so U can help??
Message-Id: <ejrtka$9pm$1@mlucom4.urz.uni-halle.de>

robertospara wrote:

 > I am involved in work under project that will visualize the process of
 > matching the regex to input text.
 > As data to highlight sub-regexes which take a part in each step of
 > matching I want to use perl debugger output from regex compilation (
 > perl -e '-re debug; $text =~/regex/'). In the doc file perldebguts is
 > very  less information about subregexes position in regex that are
 > already use in matching process. If someone every wanted to do that
 > could have said the same. My question: Eny ideas to get out from
 > debugger output elements that I could highlight in each step to
 > visualize matching process.
 >
 > My last idea was that I could take from offsets (look in perldebguts if
 > don't know what I mean) the position where sub-regex is ending for
 > example :
 >
 >     my_regex == son((mother)?father*)+daughter

I don't really understand what your goal is here -
and I'm none of the gurus, but I find that question
interesting.

What I guess what you want is to trace the
Regex evaluation, sth. like
- find the match
- find the part of the regex that made the match

If thats so, it'll be rather simple. Use code
assertions for that, eg.
you have a string:

     my $text = 'mother and father have a son and a daughter';

and a regex:

     my $regex = qr/(mother|father)?.*?(son|daughter)/;

and want to match sth. like:

     $text =~ /$regex/g;

To know what happens upon the evaluations,
just print out the steps:

  ...
  my $text = 'mother and father have a son and a daughter';

  my $rg = qr'(mother|father)? (?{ print "\t\t(mother|father) matches:", substr($text,$-[1],$+[1]-$-[1]), "\n" })
              .*?              (?{ print "\t\t.*?             matches: $& \n" })
              (son|daughter)   (?{ print "\t\t(son|daughter)  matches:", substr($text,$-[2],$+[2]-$-[2]), "\n" })
             'x;

  print "@{[ $text =~ m/$rg/g ]}";
  ...

Maybe what you really want is much more complicated,
but don't miss the modules YAPE::Regex::Explain and
GraphViz::Regex in addidtion to your

   $> perl -Mre=debug mysource.pl


Regards

Mirco


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

Date: 19 Nov 2006 22:44:35 -0800
From: "R Krause" <rkrause@searstower.org>
Subject: Re: FAQ 7.17 How can I access a dynamic variable while a similarly named lexical is in scope?
Message-Id: <1164005075.599296.97040@h48g2000cwc.googlegroups.com>

There is a third way which isn't mentioned in the FAQ. It bypasses the
need for a package name, and simply looks in the current symbol table.

            print "lexical is $var\n";
            print "global  is ${*var}\n";   # grab the scalar entry
from the 'var' typeglob

--Randall

PerlFAQ Server wrote:
> This is an excerpt from the latest version perlfaq7.pod, which
> comes with the standard Perl distribution. These postings aim to
> reduce the number of repeated questions as well as allow the community
> to review and update the answers. The latest version of the complete
> perlfaq is at http://faq.perl.org .
>
> --------------------------------------------------------------------
>
> 7.17: How can I access a dynamic variable while a similarly named lexical is in scope?



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

Date: 19 Nov 2006 23:53:29 -0800
From: "robertospara" <robertospara@gmail.com>
Subject: Re: Fetching input character without newline?
Message-Id: <1164009209.268104.81260@k70g2000cwa.googlegroups.com>

while ()
{
print "Enter your response here (1-5): ";
$ret = <STDIN>;
if ($ret =~ /^([1-5])$/)
 {print "\nUser chose $1\n";
  last;
 }

}
It's your code. How can we solve problems from your post when there
were to many mistakes in it?
So I thought U have no idea about Perl because your script seamed to be
like this.
So this was first problem in your post.
Second was real one that U were interested in.
So on future: better write sample code.
Bye.
Mark napisal(a):
> "DJ Stunks" <DJStunks@gmail.com> wrote:
> >
> > I think you should try using Term::ReadKey a little harder...
>
> (pours a gin & tonic...)
>
> Ok, this is as close as I can get to what I was trying to describe:
>
> _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
> use Term::ReadKey;
>
> ReadMode 3;
> $key = "";
> print "Your input? [(Y)es|(N)o|(Q)uit]: ";
> while ($key !~ /^[y|n|q]$/i)
>  {
>   $key = ReadKey 0;
>  }
> printf "\nYou entered $key\n";
> _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
>
> Actually this is probably what I _should_ have been trying
> to come up with. Incorrect responses are not echoed on
> screen; a correct response is processed.
>
> What I was _trying_ to get was the behavior that this script
> provides, with incorrect respones being echoed onscreen,
> with the list of incorrect respones growing towards the right
> until a correct resonse is eventually given. But this is probably
> a more sensible implementation.
>
> But if anyone knows how to implement this script with the
> incorrect responses echoed on screen, I would like to see it.
> 
> Thanks
> -Mark



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

Date: 19 Nov 2006 23:27:57 -0800
From: "R Krause" <rkrause@searstower.org>
Subject: How to change Perl's concept of a newline in regexps?
Message-Id: <1164007677.453234.10380@k70g2000cwa.googlegroups.com>

I know that $/ is the input record separator. But that doesn't seem to
affect any change in the behavior of regular expressions in normal and
multi-line mode.

For example, this returns false since we end the string with a CR
instead of a LF:

$var = "Hello\r";
return 1  if( $var =~ m/^Hello$/ );

How does one change the default newline character used in pattern
matching operations? Is there a Perl variable that can be set?

TIA,
--Randall



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

Date: 20 Nov 2006 00:22:14 -0800
From: "robertospara" <robertospara@gmail.com>
Subject: Re: How to change Perl's concept of a newline in regexps?
Message-Id: <1164010934.638565.310030@m7g2000cwm.googlegroups.com>

I think I want to know something similar.
Look to discussion >>>is there '\0' like in C in Perl also<<<
Because $ - right border of the matching text is usually before new
line >>>$\n   <<<
But in case of \r is after it >>>\r$<<<.
what is really in string when I input $something = <INPUT> end press
enter

Is there $something = 'characters'.'\n' and nothing else

or something like this or similar $something = 'characters'.'\0'.'\n'
 ???????????
Then Perl would know where to match $ <--end of the string --> to '\0'
<-- end of the string.

Is there someone who will understand
me?????????????????????????????????????????????????


On 20 Lis, 08:27, "R Krause" <rkra...@searstower.org> wrote:
> I know that $/ is the input record separator. But that doesn't seem to
> affect any change in the behavior of regular expressions in normal and
> multi-line mode.
>
> For example, this returns false since we end the string with a CR
> instead of a LF:
>
> $var = "Hello\r";
> return 1  if( $var =~ m/^Hello$/ );
>
> How does one change the default newline character used in pattern
> matching operations? Is there a Perl variable that can be set?
> 
> TIA,
> --Randall



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

Date: Mon, 20 Nov 2006 08:58:47 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: How to change Perl's concept of a newline in regexps?
Message-Id: <ejrqo7$1v3o$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
R Krause
<rkrause@searstower.org>], who wrote in article <1164007677.453234.10380@k70g2000cwa.googlegroups.com>:
> $var = "Hello\r";
> return 1  if( $var =~ m/^Hello$/ );

> How does one change the default newline character used in pattern
> matching operations?

Usually, one won't need to do this.  My bet is that you do something
in a very far from optimal way

> Is there a Perl variable that can be set?

No.

Hope this helps,
Ilya

P.S.  Do not forget that (in //m mode) $ is just a shortcut for
      (?=\n|\z), and ^ for (?:\A|(?<=\n)).  Likewise for no //m.


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

Date: Mon, 20 Nov 2006 13:45:56 +0800
From: Bo Yang <struggle@mail.nankai.edu.cn>
Subject: Re: How to compress a big file into many zip files with Archive::Zip?
Message-Id: <ejrhi1$p21$1@news.cn99.com>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

anno4000@radom.zrz.tu-berlin.de :
> Bo Yang  <struggle@mail.nankai.edu.cn> wrote in comp.lang.perl.misc:
>> -----BEGIN xxx SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> I want to email a big file to in my application.
>> But the email system will only delivery attachment
>> with no more than 20M big. So I need compress the
>> big file into many little zip files, and email
>> separately.
> 
> No.  Email isn't a file transfer program.  Use a file transfer
> program to send your file in one piece.
But we have no ftp server, so we must transfer it through
our mail server.
> 
>> And I have read the Archive::Zip document, and didn't
>> find any stuff about that.
> 
> That's because Archive::Zip is about compressing files, not
> splitting them.
I think zip can do multivolume compress. I have heard of that.
> 
>> Any suggestion will be greatly appreciated !
> 
> Use the right tool for the job.
> 
> Anno

-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFYUEU7tZp58UCwyMRAumqAKDhHOjkofxXZm14dsiozj9xt5PzXwCggeRA
Lrvg89CgzWSh3UPFljL+Y5Y=
=5Mlz
-----END PGP SIGNATURE-----


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

Date: Mon, 20 Nov 2006 13:47:06 +0800
From: Bo Yang <struggle@mail.nankai.edu.cn>
Subject: Re: How to compress a big file into many zip files with Archive::Zip?
Message-Id: <ejrhk7$p21$2@news.cn99.com>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

Martijn Lievaart :
> On Sun, 19 Nov 2006 10:05:41 +0000, anno4000 wrote:
> 
>>> And I have read the Archive::Zip document, and didn't
>>> find any stuff about that.
>> That's because Archive::Zip is about compressing files, not
>> splitting them.
> 
> However, zip has options for multivolume archives, Archive::Zip just
> doesn't support it. So the expectation is not unreasonable.
Why the module doesn't support such a practical function.
If I want to add this feature to this module, How could
I do ?


-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFYUFa7tZp58UCwyMRApGvAKDVu8RZImvag2suU7U8aQv9kxgZMQCeNilu
MDxpE5Ryl+8PF8uH2FgrSzY=
=PyY+
-----END PGP SIGNATURE-----


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

Date: Mon, 20 Nov 2006 05:42:11 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Mon Nov 20 2006
Message-Id: <J90L6B.o44@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

ABI-1.0
http://search.cpan.org/~malay/ABI-1.0/
Perl module to parse chromatogram files generated by Applied Biosystems (ABI) automated DNA sequencing machine.
----
Catalyst-Action-REST-0.1
http://search.cpan.org/~holoway/Catalyst-Action-REST-0.1/
Automated REST Method Dispatching
----
DateTime-Format-Natural-EN-0.08
http://search.cpan.org/~schubiger/DateTime-Format-Natural-EN-0.08/
Create machine readable date/time with natural parsing logic
----
DateTime-Format-Natural-EN-0.09
http://search.cpan.org/~schubiger/DateTime-Format-Natural-EN-0.09/
Create machine readable date/time with natural parsing logic
----
Email-Address-1.881
http://search.cpan.org/~rjbs/Email-Address-1.881/
RFC 2822 Address Parsing and Creation
----
FabForce-DBDesigner4-0.05
http://search.cpan.org/~reneeb/FabForce-DBDesigner4-0.05/
Parse/Analyse XML-Files created by DBDesigner 4 (FabForce)
----
File-RsyncP-0.68
http://search.cpan.org/~cbarratt/File-RsyncP-0.68/
Perl Rsync client
----
Geo-Coder-Ja-0.01
http://search.cpan.org/~jiro/Geo-Coder-Ja-0.01/
geocoder.ja library module for Perl
----
Glib-1.141
http://search.cpan.org/~tsch/Glib-1.141/
Perl wrappers for the GLib utility and Object libraries
----
Gtk2-1.141
http://search.cpan.org/~tsch/Gtk2-1.141/
Perl interface to the 2.x series of the Gimp Toolkit library
----
HTML2XHTML-0.03.05
http://search.cpan.org/~oembry/HTML2XHTML-0.03.05/
Wrapper to command-line program that converts from HTML 3.x/4.x to XHTML 1.0
----
Inline-C2XS-0.07
http://search.cpan.org/~sisyphus/Inline-C2XS-0.07/
create an XS file from Inline C code.
----
Inline-CPP2XS-0.07
http://search.cpan.org/~sisyphus/Inline-CPP2XS-0.07/
create an XS file from Inline::CPP code.
----
Net-Flickr-API-1.63
http://search.cpan.org/~ascope/Net-Flickr-API-1.63/
base API class for Net::Flickr::* libraries
----
Net-Flickr-Backup-2.96
http://search.cpan.org/~ascope/Net-Flickr-Backup-2.96/
OOP for backing up your Flickr photos locally
----
Net-Flickr-RDF-1.96
http://search.cpan.org/~ascope/Net-Flickr-RDF-1.96/
a.k.a RDF::Describes::Flickr
----
Net-GPSD-0.27
http://search.cpan.org/~mrdvt/Net-GPSD-0.27/
Provides an perl object client interface to the gpsd server daemon.
----
Net-GPSD-Server-Fake-0.05
http://search.cpan.org/~mrdvt/Net-GPSD-Server-Fake-0.05/
Provides a Fake GPSD daemon server test harness.
----
Net-Gadu-1.6
http://search.cpan.org/~krzak/Net-Gadu-1.6/
Interfejs do biblioteki libgadu.so dla protoko?u Gadu-Gadu
----
POE-Component-IRC-5.13
http://search.cpan.org/~bingos/POE-Component-IRC-5.13/
a fully event-driven IRC client module.
----
POE-Component-Server-IRC-1.05
http://search.cpan.org/~bingos/POE-Component-Server-IRC-1.05/
a fully event-driven networkable IRC server daemon module.
----
Spreadsheet-SimpleExcel-1.4
http://search.cpan.org/~reneeb/Spreadsheet-SimpleExcel-1.4/
Create Excel files with Perl
----
Test-CheckManifest-0.5
http://search.cpan.org/~reneeb/Test-CheckManifest-0.5/
Check if your Manifest matches your distro
----
Tie-Tk-Text-0.01
http://search.cpan.org/~mjcarman/Tie-Tk-Text-0.01/
Access Tk::Text or Tk::ROText widgets as arrays.
----
Tk-DiffText-0.13
http://search.cpan.org/~mjcarman/Tk-DiffText-0.13/
Perl/Tk composite widget for colorized diffs.
----
WWW-IndexParser-0.8
http://search.cpan.org/~jeb/WWW-IndexParser-0.8/
Fetch and parse the directory index from a web server
----
WWW-Myspace-0.60
http://search.cpan.org/~grantg/WWW-Myspace-0.60/
Access MySpace.com profile information from Perl
----
XML-XPathScript-1.46_01
http://search.cpan.org/~yanick/XML-XPathScript-1.46_01/
a Perl framework for XML stylesheets
----
autobox-1.04
http://search.cpan.org/~chocolate/autobox-1.04/
use builtin datatypes as first-class objects


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: 19 Nov 2006 23:05:11 -0800
From: "R Krause" <rkrause@searstower.org>
Subject: Re: Perl is worth nothing!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Message-Id: <1164006311.133643.58360@e3g2000cwe.googlegroups.com>

robertospara wrote:
> It's language with only theoretical objective support.
> It's to slow.
> It's to much memory required.
> It's not for every platform.
> There's no types so programmer can make much more mistakes.
> It's not readable to find out what other programmer wanted  to have
> when U read largest projects,
> specially when this first was not using >>> -w  <<<< or >>> use strict
> <<<.
> Perl society of masters is closed and unfriendly to the others.

I love Perl. Sure, it's not right for every application, but if you
need a robust, flexible, and powerful RAD tool, Perl beats most other
alternatives hands down. True, it doesn't enforce strict variable
typing, it's not always memory conservative, it doesn't have universal
platform support, and it encourages obfuscated coding constructs -- but
all those same arguments can be made of ECMAScript which is the de
facto standard for scripting front-end Web applications -- and even so
it's neen declared one of the world's most popular computer languages.
Truth is, you should use whatever language works for you. Nothing is
perfect, but that doesn't therefore make everything useless. From the
sound of it, you'll have great luck with C++.

--Randall



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

Date: Mon, 20 Nov 2006 09:52:11 +0000
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: Perl is worth nothing!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Message-Id: <45617acb$0$8710$ed2619ec@ptn-nntp-reader02.plus.net>

So how do you explain all the rather useful
work people are doing with it?

   BugBear


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

Date: Mon, 20 Nov 2006 09:44:58 +0100
From: "Ferry Bolhar" <bol@adv.magwien.gv.at>
Subject: Re: Perl is worth noting!
Message-Id: <1164012310.377063@proxy.dienste.wien.at>

Ben Morrow:

> sv.h lists 16 types of perl value; the others (PVIV and PVNV for scalars
> that have both a numeric and a string value; PVMG for blessed scalars;
> PVBM for making index and regexen run faster; and PVLV for lvalue
> substr) are not visible from Perl.

Well, I think, PVMG's are visible via "blessed references".

BTW, that's an interesting fact that there is no exclusive type
for them, because PVMG  intentionally was created to hold
magic ("tied") types of SVs, not blessed scalars.

If you take a simple scalar

my $a = 5;

and mark it as object

bless \$a;

the SV represented my $a is upgraded to a SVMG but still
doesn't contain any magic!

Greetings, Ferry

-- 
Ing Ferry Bolhar
Magistrat der Stadt Wien - MA 14
A-1010 Wien
E-Mail: bol@adv.magwien.gv.at




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

Date: 20 Nov 2006 01:49:22 -0800
From: "alexxx.magni@gmail.com" <alexxx.magni@gmail.com>
Subject: Re: print to terminal
Message-Id: <1164016162.712927.200570@e3g2000cwe.googlegroups.com>

thanks!
Of course I already had the module installed, and completely forgotten
it...
I had hope there was an even cleaner way (by some magick regex trick '
'=>'\n' at the appropriate places...) but it's OK enough this way.
But, one more small problem: I have to specify manually the number of
columns, since the module does not check it by itself.
Googling I found just 2 ways to do it:

use Text::Wrap qw(wrap $columns);

my $columns=`tput cols`;
# OR:
# $x=`stty -a`;$x=~/columns (\d+)/;$columns=$1;

but I dont like neither.
Do you know a better way? I tried to use $ENV{COLUMNS} but discovered
that this hash value does not exist, during execution - where can I
also find the number of columns value?

Thanks!

Alessandro

Christian Winter ha scritto:

> alexxx.magni@gmail.com wrote:
> > hi people,
> > I need to print to terminal a long $variable containing text, and of
> > course being longer than the terminal width it produces a truncated
> > word that continues on the next line - I'd like to go newline just on
> > spaces...
> >
> > I wrote an approximated version to "prettyprint" it, but it's so awful
> > that I prefer not to show it in public...
> >
> > Do you know of some elegant way to do it? (there should be more than
> > one way...;-)
> 
> Have a look at the Text::Wrap module.
> 
> -Chris



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

Date: 20 Nov 2006 01:53:07 -0800
From: "MoshiachNow" <lev.weissman@creo.com>
Subject: Win32::Registry::File - update values in file
Message-Id: <1164016387.051190.173840@b28g2000cwb.googlegroups.com>

HI,

Having a .reg file,I need to update all occurances of the old machine
name there into a new name.
Some stings are just plane (REG_SZ) ex:
"NodeList"="KDI-PGY2500"

but some are of multiple type (REG_MULTI_SZ) ex:
"VolumeList"=hex(7):5c,00,5c,00,50,00,47,00,59,00,32,00,36,00,30,00,30,00,5c,\

00,32,00,36,00,30,00,30,00,5c,00,41,00,72,00,61,00,78,00,69,00,56,00,6f,00,\

6c,00,75,00,6d,00,65,00,5f,00,50,00,47,00,59,00,32,00,36,00,30,00,30,00,5f,\
  . . .
6f,00,66,00,69,00,6c,00,65,00,73,00,00,00,00,00

(Note that the above hex stirngs ALSO hides inside the old machine name
KDI-PGY2500,it's just hidden by formatting)
I need to go over the whole file and replace ALL VALUES from the old
name to a new one using Win32::Registry::File.
Any idea how to do it ?
Thanks



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

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


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