Re: sort without ignoring hyphens

2008-03-31 Thread John W. Krahn
[EMAIL PROTECTED] wrote: On Mar 30, 10:57 pm, [EMAIL PROTECTED] (John W. Krahn) wrote: It appears to work in Perl: $ perl -le'@x = qw[22 2-2 2-3 23 21]; print for sort @x' 2-2 2-3 21 22 23 I'm looking for the perl way of comparing strings. Your posted code 'diff says memory exhausted need h

Re: sort without ignoring hyphens

2008-03-31 Thread tc314
On Mar 31, 11:44 am, [EMAIL PROTECTED] (Dr.Ruud) wrote: > [EMAIL PROTECTED] schreef: > > > unsorted: > > 22 > > 2-2 > > 2-3 > > 23 > > 21 > > > linux sort produces: > > 21 > > 22 > > 2-2 > > 23 > > 2-3 > > $ echo ' > 21 > 22 > 2-4 > 2-2 > 23 > 2-3 > ' |sort -n > > 2-2 > 2-3 > 2-4 > 21 > 22 > 23 > >

Re: sort without ignoring hyphens

2008-03-31 Thread tc314
On Mar 30, 10:57 pm, [EMAIL PROTECTED] (John W. Krahn) wrote: > [EMAIL PROTECTED] wrote: > > > On Mar 29, 4:19 pm, [EMAIL PROTECTED] (John W. Krahn) wrote: > > >> [EMAIL PROTECTED] wrote: > > >>> When I do string comparisons in perl the strings seem to ignore the > >>> embedded hyphens. > >>> I wan

Re: commify_series script in cookbook page 94

2008-03-31 Thread Rob Dixon
John W. Krahn wrote: > Rob Dixon wrote: >> Dr.Ruud wrote: >>> Rob Dixon schreef: It's equivalent to: my $sepchar = ','; foreach (@_) { if (/,/) { $sepchar = ';'; last; } } And IMO is much better written that way. >>> T

Re: commify_series script in cookbook page 94

2008-03-31 Thread Rob Dixon
Chas. Owens wrote: > On Mon, Mar 31, 2008 at 2:30 PM, Rob Dixon <[EMAIL PROTECTED]> wrote: > snip >> > my $sepchar = ','; >> > for (@_) { $sepchar = ";" and last if /\Q$sepchar/ } >> >> This relies on ';' being true, and uses 'and' in void context. >> > snip > > There is nothing wrong w

Re: commify_series script in cookbook page 94

2008-03-31 Thread John W. Krahn
Rob Dixon wrote: Dr.Ruud wrote: Rob Dixon schreef: It's equivalent to: my $sepchar = ','; foreach (@_) { if (/,/) { $sepchar = ';'; last; } } And IMO is much better written that way. TIMTOWTDI. But I'm sure you'll agree that some ways are more awkward or obfuscate

Re: commify_series script in cookbook page 94

2008-03-31 Thread Chas. Owens
On Mon, Mar 31, 2008 at 2:30 PM, Rob Dixon <[EMAIL PROTECTED]> wrote: snip > > my $sepchar = ','; > > for (@_) { $sepchar = ";" and last if /\Q$sepchar/ } > > This relies on ';' being true, and uses 'and' in void context. > snip There is nothing wrong with using and in void context. If

Re: Uninitialized value in pattern match

2008-03-31 Thread Rob Dixon
Johan wrote: > > The last line of this code > foreach $PkgFile( @$PkgList ) > { > if( $PkgFile =~m/^\s*$/) > > gives this warning message > Use of uninitialized value in pattern match (m//) at packagefile.pm > line 838. > > How can I solve this? (I have no idea what the code does...) Som

Re: parser using perl

2008-03-31 Thread Chas. Owens
On Mon, Mar 31, 2008 at 2:43 PM, Rob Dixon <[EMAIL PROTECTED]> wrote: > Chas. Owens wrote: > > > > In general, it doesn't matter if you want to work with a small piece > > of a language or the whole language, you still need to implement a > > parser for the whole language. You can get an eighty

Re: parser using perl

2008-03-31 Thread Rob Dixon
Chas. Owens wrote: > > In general, it doesn't matter if you want to work with a small piece > of a language or the whole language, you still need to implement a > parser for the whole language. You can get an eighty or ninety > percent solution without a full parser, but there will always be > pro

Re: commify_series script in cookbook page 94

2008-03-31 Thread Rob Dixon
Dr.Ruud wrote: > Rob Dixon schreef: >> Richard Lee wrote: >>> Dr.Ruud wrote: Richard Lee schreef: > > While reading perl cookbook, I came to page 94 and having a hard > time understanding this particular phrase > my $sepchar = grep( /,/ => @_ ) ? ";" : ","; Shortcutting a

Re: sort without ignoring hyphens

2008-03-31 Thread Dr.Ruud
[EMAIL PROTECTED] schreef: > unsorted: > 22 > 2-2 > 2-3 > 23 > 21 > > linux sort produces: > 21 > 22 > 2-2 > 23 > 2-3 $ echo ' 21 22 2-4 2-2 23 2-3 ' |sort -n 2-2 2-3 2-4 21 22 23 -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

Re: commify_series script in cookbook page 94

2008-03-31 Thread Dr.Ruud
Rob Dixon schreef: > Richard Lee wrote: >> Dr.Ruud wrote: >>> Richard Lee schreef: While reading perl cookbook, I came to page 94 and having a hard time understanding this particular phrase my $sepchar = grep( /,/ => @_ ) ? ";" : ","; >>> >>> Shortcutting alternative: >>> m

Re: parser using perl

2008-03-31 Thread Randal L. Schwartz
> ""Chas" == "Chas Owens" <[EMAIL PROTECTED]> writes: "Chas> Take a look at Parse::RecDescent*. Also, look at Parse::Marpa if you have Perl 5.10 (requires 5.10), which not only parses text like P::RD, but can also tell you if there are *multiple* *ambiguous* parsings, rather efficiently. Ver

Re: parser using perl

2008-03-31 Thread Chas. Owens
On Mon, Mar 31, 2008 at 11:05 AM, Sharan Basappa <[EMAIL PROTECTED]> wrote: > true, I have the grammar in the form of BNF. But I am not interested > in converting > the BNF to parser rules, when I know that these productions are not > useful to me. > I am planning to write 8-10 rules and rules

Re: Inappropriate ioctl for device

2008-03-31 Thread Chas. Owens
On Sun, Mar 30, 2008 at 10:56 PM, John W. Krahn <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > > > On Mar 30, 6:54 am, [EMAIL PROTECTED] (John W. Krahn) wrote: > >> > > >> die() exits the program. > >> > > Yes, I understand that die() exits the program. My question was are > > you

Re: parser using perl

2008-03-31 Thread Sharan Basappa
true, I have the grammar in the form of BNF. But I am not interested in converting the BNF to parser rules, when I know that these productions are not useful to me. I am planning to write 8-10 rules and rules for pertaining tokens only. Of course, I might have to write additional rules to catch com

Re: parser using perl

2008-03-31 Thread Chas. Owens
On Mon, Mar 31, 2008 at 10:51 AM, Sharan Basappa <[EMAIL PROTECTED]> wrote: > I am not a compler expert, but if I all I am interested in few > productions out of > many productions, I can setup by scanner to generate tokens pertaining to > interesting productions and ignore the rest. As I said,

Re: Uninitialized value in pattern match

2008-03-31 Thread Rob Coops
Hi Johan, Ok so lets first of all see what is in this variable called: $PkgList I suggest using a command like, just before the foreach loop (for testing puropses): use Data::Dumper; print Dumper $PkgList; You can remove this after a single run, this will print the contents of the variable to STD

Re: parser using perl

2008-03-31 Thread Sharan Basappa
I am not a compler expert, but if I all I am interested in few productions out of many productions, I can setup by scanner to generate tokens pertaining to interesting productions and ignore the rest. As I said, I am not a compiler expert. So, I could be understating the problem .. I will have a l

Re: parser using perl

2008-03-31 Thread Chas. Owens
On Mon, Mar 31, 2008 at 10:36 AM, Sharan Basappa <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to extract information from a file that follows the syntax > of a high level language (something like C++) > The script just needs to understand a very minuscule portion of this > language to do th

parser using perl

2008-03-31 Thread Sharan Basappa
Hi, I am trying to extract information from a file that follows the syntax of a high level language (something like C++) The script just needs to understand a very minuscule portion of this language to do this. It does not have to know the complete high level language. I just wanted to know any mo

Re: Problem with STAT under Windows

2008-03-31 Thread Gunnar Hjalmarsson
anders wrote: I tryed some testkod below, i like Perl to give med TIME for every file, But all variable just get blank, (i got filename). You need to either alter the current directory using chdir(), or pass the full path to stat(). You may want to try this code: use strict; use war

Uninitialized value in pattern match

2008-03-31 Thread Johan
The last line of this code foreach $PkgFile( @$PkgList ) { if( $PkgFile =~m/^\s*$/) gives this warning message Use of uninitialized value in pattern match (m//) at packagefile.pm line 838. How can I solve this? (I have no idea what the code does...) -- To unsubscribe, e-mail: [EMAIL P

Re: algorithm/permute.pm

2008-03-31 Thread Sharan Basappa
Here is what I have been able to do after installing the permute module: My updated code looks like: #!/usr/bin/perl use lib "/u/basappas/local/perl/Algorithm-Permute-0.06/Algorithm::Permute"; Algorithm::Permute::permute { print "@array\n" } @array; When I execute this script, I get the following

Re: algorithm/permute.pm

2008-03-31 Thread Sharan Basappa
I did the following: perl Makefile.PL PREFIX=/u/basappas/local/perl/Algorithm-Permute-0.06 I got the following message: perl/Algorithm-Permute-0.06 Writing Makefile for Algorithm::Permute Now what? Should I execute the make file? After that can I point to this library and start using new library

Problem with STAT under Windows

2008-03-31 Thread anders
I tryed some testkod below, i like Perl to give med TIME for every file, But all variable just get blank, (i got filename). # Reads all files to a list sub readFileList { my @result; local $dev; local $ino; local $mode; local$nlink; local $uid; local $gid; local $r

RE: parse x.500 DN and change order displayed

2008-03-31 Thread peter
> Peter Scott <[EMAIL PROTECTED]> wrote: >> On Sun, 30 Mar 2008 20:36:58 -0700, SecureIT wrote: >> > I am trying to change this >> > >> > "cn=Bob Smith+serialNumber=CR013120080827,o=ICM,c=US" >> > >> > to this: >> > >> > "serialNumber=CR013120080827+cn=Bob Smith,o=ICM,c=US" > >>s/^(cn=.*?)+(.*?

RE: parse x.500 DN and change order displayed

2008-03-31 Thread Thomas Bätzler
Peter Scott <[EMAIL PROTECTED]> wrote: > On Sun, 30 Mar 2008 20:36:58 -0700, SecureIT wrote: > > I am trying to change this > > > > "cn=Bob Smith+serialNumber=CR013120080827,o=ICM,c=US" > > > > to this: > > > > "serialNumber=CR013120080827+cn=Bob Smith,o=ICM,c=US" >s/^(cn=.*?)+(.*?),/$2+$

Re: parse x.500 DN and change order displayed

2008-03-31 Thread Peter Scott
On Sun, 30 Mar 2008 20:36:58 -0700, SecureIT wrote: > I am trying to change this > > "cn=Bob Smith+serialNumber=CR013120080827,o=ICM,c=US" > > to this: > > "serialNumber=CR013120080827+cn=Bob Smith,o=ICM,c=US" > > There are about 2000 entries like this and I need to have them all > displayed wi

parse x.500 DN and change order displayed

2008-03-31 Thread SecureIT
I am trying to change this "cn=Bob Smith+serialNumber=CR013120080827,o=ICM,c=US" to this: "serialNumber=CR013120080827+cn=Bob Smith,o=ICM,c=US" There are about 2000 entries like this and I need to have them all displayed with serialNumber first, and cn last then the rest of the DN, the names an

Re: perl byte code generation

2008-03-31 Thread anders
On 31 Mar, 08:41, [EMAIL PROTECTED] (Anirban Adhikary) wrote: > Dear list > I want to compile a perl code into some encrypted format . My main goal is I > don't want to give anyone my source code and I want only to give the > executable. These codes will run only on Unix flavors O.S. So how to do t

Re: commify_series script in cookbook page 94

2008-03-31 Thread Rob Dixon
Richard Lee wrote: > Dr.Ruud wrote: >> Richard Lee schreef: >> >> >>> While reading perl cookbook, I came to page 94 and having a hard time >>> understanding this particular phrase >>> >>> my $sepchar = grep( /,/ => @_ ) ? ";" : ","; >>> >> Shortcutting alternative: >> >> my $sepchar =

Re: Load hash from a scalar

2008-03-31 Thread John W. Krahn
sanket vaidya wrote: From: scooter [mailto:[EMAIL PROTECTED] I want to load the value from scalar variable to a hash Example: my $a = "a, 1, b, 2, c, 3"; Now, I need to create a hash %b, which holds values like %b = { a => 1, b => 2, c => 3 }; Here is the code to accomplish your task. u