Re: Splitting two numbers joined by a minus sign

2007-11-09 Thread Rob Dixon
michael wang wrote: if the minus sign always there, then use s/// seems faster than split, like while(){ s/(\d)-/$1\t-/; print "$_"; } I'm pretty certain the OP wanted the data separated into fields so it would still have to be split. I do like the idea of adding the 'missing' space

Re: format magic and STDOUT

2007-11-09 Thread John W . Krahn
On Friday 09 November 2007 10:30, [EMAIL PROTECTED] wrote: > Ok, so I'm not *really* a beginner; however, wondering if this is > possible You have read the perlform man page? perldoc perlform > I have a subroutine that basically goes through an array and searches > for processes... It has t

format magic and STDOUT

2007-11-09 Thread ajpavlis
Ok, so I'm not *really* a beginner; however, wondering if this is possible I have a subroutine that basically goes through an array and searches for processes... It has two different types of processes it looks for, so I just grabbed ps using ps -ef |grep someuser | grep someapp and threw it i

Re: variably named subroutines

2007-11-09 Thread Rob Dixon
Martijn wrote: On Nov 9, 2007 6:44 PM, Paul Lalli <[EMAIL PROTECTED]> wrote: You should have tried the FAQ first. I should. Well, I did, but I should have realised that this question was not specific to subroutine names. In any case, I feel rather stupid for asking my question now. Re-readi

Re: variably named subroutines

2007-11-09 Thread Martijn
On Nov 9, 2007 6:44 PM, Paul Lalli <[EMAIL PROTECTED]> wrote: > You should have tried the FAQ first. I should. Well, I did, but I should have realised that this question was not specific to subroutine names. In any case, I feel rather stupid for asking my question now. Re-reading the code of the

Re: Hash slice

2007-11-09 Thread Jenda Krynicky
From: "Beginner" <[EMAIL PROTECTED]> > On 9 Nov 2007 at 16:35, Jenda Krynicky wrote: > > > From: "Beginner" <[EMAIL PROTECTED]> > > > #!/bin/perl > > > > > > use strict; > > > use warnings; > > > use Data::Dumper; > > > > > > my @keys = qw(fe fi fo thumb); > > > my @valone = 1..4; > > > my @valt

Re: variably named subroutines

2007-11-09 Thread Paul Lalli
On Nov 9, 1:27 pm, [EMAIL PROTECTED] (Martijn) wrote: > I simple question to which that I can't find the answer. You should have tried the FAQ first. > How does one > create a subroutine whose name is defined by the value of a variable? perldoc -q "variable name" > To be more precise, I need to

Re: variably named subroutines

2007-11-09 Thread Chas. Owens
On Nov 9, 2007 1:27 PM, Martijn <[EMAIL PROTECTED]> wrote: > Hello. > > I simple question to which that I can't find the answer. How does one > create a subroutine whose name is defined by the value of a variable? > To be more precise, I need to write a bunch of subroutines foo_bar1, > foo_bar2, ..

Re: Hash slice

2007-11-09 Thread Paul Lalli
On Nov 9, 11:09 am, [EMAIL PROTECTED] (Beginner) wrote: > What I was attempting was to have each key to be assigned the > coresponding items from the array. Why didn't you just say that in the first place, rather than letting everyone guess as to what you wanted? > So it might look like something

variably named subroutines

2007-11-09 Thread Martijn
Hello. I simple question to which that I can't find the answer. How does one create a subroutine whose name is defined by the value of a variable? To be more precise, I need to write a bunch of subroutines foo_bar1, foo_bar2, ... where 1) I can't know the number of these routines beforehand and 2)

Re: Hash slice

2007-11-09 Thread Rob Dixon
Beginner wrote: On 9 Nov 2007 at 14:59, Rob Dixon wrote: Beginner wrote: Is it possible to make a hash slice like so It's certainly possible, but I'm not sure why you've taken a reference to your key and value arrays. [EMAIL PROTECTED] is a single scalar value, as is [EMAIL PROTECTED], so

Re: Hash slice

2007-11-09 Thread [EMAIL PROTECTED]
On Nov 9, 4:09 pm, [EMAIL PROTECTED] (Beginner) wrote: > On 9 Nov 2007 at 16:35, Jenda Krynicky wrote: > > What I was attempting was to have each key to be assigned the > coresponding items from the array. So it might look like something > like: Right, so your question has nothing to do with hash

Re: Hash slice

2007-11-09 Thread [EMAIL PROTECTED]
On Nov 9, 3:35 pm, [EMAIL PROTECTED] (Jenda Krynicky) wrote: > > @[EMAIL PROTECTED] = ( [EMAIL PROTECTED],[EMAIL PROTECTED]); Note that _can_ also be written @[EMAIL PROTECTED] = \( @valone, @valtwo); But IMNSHO it this syntax should _only_ be used in code that is intended as part of a respon

Re: Splitting two numbers joined by a minus sign

2007-11-09 Thread michael wang
if the minus sign always there, then use s/// seems faster than split, like while(){ s/(\d)-/$1\t-/; print "$_"; } On 11/9/07, Paul Lalli <[EMAIL PROTECTED]> wrote: > > On Nov 9, 2:09 am, [EMAIL PROTECTED] (Rob Dixon) wrote: > > > > Why have you decided that the OP's solution doesn't p

Re: Hash slice

2007-11-09 Thread Beginner
On 9 Nov 2007 at 16:35, Jenda Krynicky wrote: > From: "Beginner" <[EMAIL PROTECTED]> > > #!/bin/perl > > > > use strict; > > use warnings; > > use Data::Dumper; > > > > my @keys = qw(fe fi fo thumb); > > my @valone = 1..4; > > my @valtwo = 10..14; > > my %hash; > > @[EMAIL PROTECTED] = [EMAIL PR

Re: protect product perl code

2007-11-09 Thread Tom Phoenix
On 11/9/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I have a question, when a web project was finished (the project was > primarily developed with perl), we deliver the product codes to > customer. > Is there a way to protect the perl codes to be not visiable as plain > text? I think you'r

Re: protect product perl code

2007-11-09 Thread John W . Krahn
On Friday 09 November 2007 07:49, [EMAIL PROTECTED] wrote: > I have a question, when a web project was finished (the project was > primarily developed with perl), we deliver the product codes to > customer. > Is there a way to protect the perl codes to be not visiable as plain > text? like the Zend

Re: Perl Encryption Game Help Please

2007-11-09 Thread John W . Krahn
On Friday 09 November 2007 04:55, John W.Krahn wrote: > > On Thursday 08 November 2007 17:11, Inventor wrote: > > > > if ($i == 0) { > > if (@s1[0] eq "QBCnlq57Byh") { > > If you had warnings enabled perl would have warned you about using an > array slice where you should be using a sca

Re: Escape quote when using-one-line-of-program mode

2007-11-09 Thread Tom Phoenix
On 11/8/07, howa <[EMAIL PROTECTED]> wrote: > 2. perl -pe 's/(?<=[^\\])\\\'//g' test.txt (Note a single quote is > inserted in the middle) Check your shell's documentation on how to quote command line arguments. If you need to find out what, exactly, a command-line argument says by the time it g

protect product perl code

2007-11-09 Thread joy_peng
I have a question, when a web project was finished (the project was primarily developed with perl), we deliver the product codes to customer. Is there a way to protect the perl codes to be not visiable as plain text? like the Zend Encoder for php. Thanks! -- To unsubscribe, e-mail: [EMAIL PROTEC

Re: Hash slice

2007-11-09 Thread Beginner
On 9 Nov 2007 at 14:59, Rob Dixon wrote: > Beginner wrote: > > Hi all, > > > > Is it possible to make a hash slice like so > Hey Dermot Hi Rob, > It's certainly possible, but I'm not sure why you've taken a reference > to your key and value arrays. [EMAIL PROTECTED] is a single scalar value,

Re: Perl Encryption Game Help Please

2007-11-09 Thread Inventor
On Nov 9, 7:55 am, [EMAIL PROTECTED] (John W . Krahn) wrote: > > Well, let's have a look at some code. :-) > > > John > -- > use Perl; > program > fulfillment Haha! You are quite the stickler for detail! My apologies for the GNU GPL mistake especially!!! I will now run off and fix everything

Re: Hash slice

2007-11-09 Thread Jenda Krynicky
From: "Beginner" <[EMAIL PROTECTED]> > #!/bin/perl > > use strict; > use warnings; > use Data::Dumper; > > my @keys = qw(fe fi fo thumb); > my @valone = 1..4; > my @valtwo = 10..14; > my %hash; > @[EMAIL PROTECTED] = [EMAIL PROTECTED],@valtwo]; [...] creates an array reference. You want @[EM

Re: Hash slice

2007-11-09 Thread Rob Dixon
Beginner wrote: Hi all, Is it possible to make a hash slice like so my %hash; @[EMAIL PROTECTED] = [EMAIL PROTECTED]; My efforts suggest not: #!/bin/perl use strict; use warnings; use Data::Dumper; my @keys = qw(fe fi fo thumb); my @vals = 1..4; my %hash; @[EMAIL PROTECTED] = [EMAIL PROTECT

Hash slice

2007-11-09 Thread Beginner
Hi all, Is it possible to make a hash slice like so my %hash; @[EMAIL PROTECTED] = [EMAIL PROTECTED]; My efforts suggest not: #!/bin/perl use strict; use warnings; use Data::Dumper; my @keys = qw(fe fi fo thumb); my @vals = 1..4; my %hash; @[EMAIL PROTECTED] = [EMAIL PROTECTED]; print Dumper

Re: Perl Encryption Game Help Please

2007-11-09 Thread Omega -1911
Why not hire a PR firm instead of filling up everyone's inbox with off-topic discussion? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Perl Encryption Game Help Please

2007-11-09 Thread Inventor
On Nov 8, 1:57 pm, [EMAIL PROTECTED] (Yitzle) wrote: > Is there a website with anything released? > You can use tr/// to create a slightly better encyption than the > rot13, where A becomes Q, and B becomes X... where the match is > randomly assigned. > > -- > - Yitzchok Good Hmmm, I answered your

Re: Perl Encryption Game Help Please

2007-11-09 Thread John W . Krahn
On Thursday 08 November 2007 17:11, Inventor wrote: > > On Nov 8, 1:57 pm, [EMAIL PROTECTED] (Yitzle) wrote: > > > > Is there a website with anything released? > > Great, thanks for asking, I have just completed Mission 2 and updated > the web site accordingly. You will find the Missions trivially

Re: Splitting two numbers joined by a minus sign

2007-11-09 Thread Paul Lalli
On Nov 9, 2:09 am, [EMAIL PROTECTED] (Rob Dixon) wrote: > > Why have you decided that the OP's solution doesn't provide what he wants, > snipped it, and offered some code that does something very different? > and he asked for a more elegant way of doing the same thing. I would have > thought it wa

Re: Writing DOS CRLF via Unix Perl

2007-11-09 Thread Rob Dixon
Wagner, David --- Senior Programmer Analyst --- WGO wrote: -Original Message- From: C.R. [mailto:[EMAIL PROTECTED] Sent: Thursday, November 08, 2007 12:34 To: beginners@perl.org Subject: Writing DOS CRLF via Unix Perl I run a script on unix Perl to write a text file. By default, when

Re: Writing DOS CRLF via Unix Perl

2007-11-09 Thread Xavier Noria
On Nov 8, 2007, at 9:33 PM, C.R. wrote: I run a script on unix Perl to write a text file. By default, when Perl writes "\n" it writes a line ending sequence which is native to the current OS. How do I force this particular script to always write DOS CRLF line endings? A good approach is to h

RE: Writing DOS CRLF via Unix Perl

2007-11-09 Thread Jenda Krynicky
From: "Wagner, David --- Senior Programmer Analyst --- > > -Original Message- > > From: C.R. [mailto:[EMAIL PROTECTED] > > Sent: Thursday, November 08, 2007 12:34 > > To: beginners@perl.org > > Subject: Writing DOS CRLF via Unix Perl > > > > I run a script on unix Perl to write a text fi

Re: Escape quote when using-one-line-of-program mode

2007-11-09 Thread Jenda Krynicky
From: howa <[EMAIL PROTECTED]> > My codes: > > This work: > > 1. perl -pe 's/(?<=[^\\])\\//g' test.txt > > > This does not: > > 2. perl -pe 's/(?<=[^\\])\\\'//g' test.txt (Note a single quote is > inserted in the middle) > > This also not working: > > 3. perl -pe "s/(?<=[^\\])\\\'//g" tes

Escape quote when using-one-line-of-program mode

2007-11-09 Thread howa
My codes: This work: 1. perl -pe 's/(?<=[^\\])\\//g' test.txt This does not: 2. perl -pe 's/(?<=[^\\])\\\'//g' test.txt (Note a single quote is inserted in the middle) This also not working: 3. perl -pe "s/(?<=[^\\])\\\'//g" test.txt So how to insert a single quote in example 2? Thanks