Re: Regex Help

2006-04-18 Thread Mr. Shawn H. Corey
On Tue, 2006-18-04 at 18:20 -0700, Tom Phoenix wrote: > You don't have to backslash the bang, because it's not a metacharacter. No, but it doesn't hurt either. If you look at the quotemeta operation (see `perldoc -f quotemeta`) its output would escape the bang. The quotemeta operator is the same a

RE: Regex Help

2006-04-18 Thread Jim
> > You need to anchor your regex. Your regex is matching '!!' because it > is matching an exclamation point followed by zero or more non > exclamation-point characters anywhere in the string. > > Thus the first '!' is matching the regex, and the second '!' is outside > of your match. yep, fo

Re: Regex Help

2006-04-18 Thread Chad Perrin
On Tue, Apr 18, 2006 at 08:52:04PM -0400, Jim wrote: > i am trying to match a '!' followed by any char but a '!' or no chars > (string is only a '!') > > this is what I have and it is not working: > > $str = "!!"; > # this is not working. it is matching "!!" > print "$str\n" if $str =~ /\![^!]*/

Re: Regex Help

2006-04-18 Thread Tom Phoenix
On 4/18/06, Jim <[EMAIL PROTECTED]> wrote: > i am trying to match a '!' followed by any char but a '!' or no chars > (string is only a '!') This smells a little bit like homework. :-) > print "$str\n" if $str =~ /\![^!]*/; You don't have to backslash the bang, because it's not a metacharacter.

RE: Regex Help

2006-04-18 Thread Timothy Johnson
You need to anchor your regex. Your regex is matching '!!' because it is matching an exclamation point followed by zero or more non exclamation-point characters anywhere in the string. Thus the first '!' is matching the regex, and the second '!' is outside of your match. Try this:

RE: Regex Help

2006-04-18 Thread Toby Stuart
> -Original Message- > From: Jim [mailto:[EMAIL PROTECTED] > Sent: Wednesday, 19 April 2006 10:52 AM > To: beginners@perl.org > Subject: Regex Help > > > i am trying to match a '!' followed by any char but a '!' or no chars > (string is only a '!') > > this is what I have and it is not w

Re: Regex Help

2006-04-18 Thread Peter Cornelius
This will match a ! followed by 0 or more not ! chars, I suppose it's matching the 0 part of that. Try a '+' instead of a '*' $str =~ /\![^!]*/; PC -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Regex Help

2006-04-18 Thread Jim
i am trying to match a '!' followed by any char but a '!' or no chars (string is only a '!') this is what I have and it is not working: $str = "!!"; # this is not working. it is matching "!!" print "$str\n" if $str =~ /\![^!]*/; Thanks for any help -- To unsubscribe, e-mail: [EMAIL PROTECTE

Re: regex matching conditionally

2006-04-18 Thread Jay Savage
On 4/18/06, Jenda Krynicky <[EMAIL PROTECTED]> wrote: > From: "Jay Savage" <[EMAIL PROTECTED]> > > On 4/14/06, JupiterHost.Net <[EMAIL PROTECTED]> wrote: > > > > > > > > > Timothy Johnson wrote: > > > > Will the string always have the two quotes in the same place and > > > > only one per string? W

Re: perl help

2006-04-18 Thread Mr. Shawn H. Corey
On Tue, 2006-18-04 at 19:34 -0400, Chas Owens wrote: > On 4/18/06, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: > snip > > Yes but in UTF-8, '0' is "\x{30}" or "\x{0030}". (The newer versions of > > Perl being 5.8+) > snip > > That was my point. That assuming \x30 is the character '0' is now > s

Re: perl help

2006-04-18 Thread Chas Owens
On 4/18/06, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: snip > Yes but in UTF-8, '0' is "\x{30}" or "\x{0030}". (The newer versions of > Perl being 5.8+) snip That was my point. That assuming \x30 is the character '0' is now safe since all source code is interpreted as UTF-8. Is input from fil

Re: perl help

2006-04-18 Thread Mr. Shawn H. Corey
On Tue, 2006-18-04 at 19:11 -0400, Chas Owens wrote: > On 4/18/06, John W. Krahn <[EMAIL PROTECTED]> wrote: > snip > > Assuming your source is ASCII or some other encoding that equates "\x30" to > > '0'. > snip > > Don't the newer versions of perl assume the character set is UTF-8? > Yes but in

Re: perl help

2006-04-18 Thread Chas Owens
On 4/18/06, John W. Krahn <[EMAIL PROTECTED]> wrote: snip > Assuming your source is ASCII or some other encoding that equates "\x30" to > '0'. snip Don't the newer versions of perl assume the character set is UTF-8? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [E

Re: perl help

2006-04-18 Thread John W. Krahn
Dr.Ruud wrote: > John W. Krahn schreef: > >>Perl actually has four false values: 0, undef, '' and '0'. One being >>the number zero and another a string with a single zero character. > > And the value '0' has many different representations in source, like > "\x30". Assuming your source is ASCII

Re: perl help

2006-04-18 Thread Dr.Ruud
John W. Krahn schreef: > Perl actually has four false values: 0, undef, '' and '0'. One being > the number zero and another a string with a single zero character. And the value '0' has many different representations in source, like "\x30". -- Affijn, Ruud "Gewoon is een tijger." -- To unsu

Re: Extracting variables from a string

2006-04-18 Thread John W. Krahn
John W. Krahn wrote: > Ed wrote: >>How would I get the various elements out of a string of known format. >>A previous post about a similar topic approaches a solution but I need >>help with the regular expression to pass to the m function. >> >>Here's an example of a string: >>net user cknotts some

Re: perl help

2006-04-18 Thread Chas Owens
On 4/18/06, John W. Krahn <[EMAIL PROTECTED]> wrote: > Chas Owens wrote: > > On 4/18/06, Irfan J Sayed <[EMAIL PROTECTED]> wrote: > > snip > >>can anybody plz tell me what i am doing wrong > > snip > > > > What you are doing wrong is making assumptions and not reading the > > documentation. This i

Re: perl help

2006-04-18 Thread Chad Perrin
On Tue, Apr 18, 2006 at 02:39:35PM -0700, John W. Krahn wrote: > Chas Owens wrote: > > On 4/18/06, Irfan J Sayed <[EMAIL PROTECTED]> wrote: > > snip > >>can anybody plz tell me what i am doing wrong > > snip > > > > What you are doing wrong is making assumptions and not reading the > > documentati

Re: Extracting variables from a string

2006-04-18 Thread John W. Krahn
Ed wrote: > How would I get the various elements out of a string of known format. > A previous post about a similar topic approaches a solution but I need > help with the regular expression to pass to the m function. > > Here's an example of a string: > net user cknotts somepassword /add /active:y

Re: perl help

2006-04-18 Thread John W. Krahn
Chas Owens wrote: > On 4/18/06, Irfan J Sayed <[EMAIL PROTECTED]> wrote: > snip >>can anybody plz tell me what i am doing wrong > snip > > What you are doing wrong is making assumptions and not reading the > documentation. This is being compounded by your inexperience with > Perl. > > First let

Interprocess communications for Windows Perl

2006-04-18 Thread Karjala
I'm making a Perl program, and someone else is writing a C++ program, and both will run on the same MS-Windows machine at the same time. What is a good way to have the two programs communicate? I'm asking because until now I've only programmed for Linux machines, and I used to use named pipes

Re: Extracting variables from a string

2006-04-18 Thread Joshua Colson
On Tue, 2006-04-18 at 11:20 -0600, Ed wrote: > How would I get the various elements out of a string of known format. > A previous post about a similar topic approaches a solution but I need > help with the regular expression to pass to the m function. > > Here's an example of a string: > net user

Re: parent / child PID / wait q

2006-04-18 Thread Chas Owens
On 4/17/06, Henry, Mark Patrick <[EMAIL PROTECTED]> wrote: snip > Seems like what I want is something along the lines of fork / > child_pids, and 'wait'. snip Yep, that is what you want. snip > If I launch multiple jobs up to max_machines as it were, and use 'wait', > it appears to only wait for

Extracting variables from a string

2006-04-18 Thread Ed
How would I get the various elements out of a string of known format. A previous post about a similar topic approaches a solution but I need help with the regular expression to pass to the m function. Here's an example of a string: net user cknotts somepassword /add /active:yes /expires:never /com

Re: How to get the argument of the ?

2006-04-18 Thread Tom Phoenix
On 4/18/06, sfantar <[EMAIL PROTECTED]> wrote: > I am at the moment trying to write on a script which gets the url > between " in the . Don't waste time writing code to parse a complex markup like HTML; it's hard to do it correctly. Use a parser, such as HTML::LinkExtor. http://search.cpan.o

Re: How to get the argument of the ?

2006-04-18 Thread Joshua Colson
On Apr 18, 2006, at 2:51 AM, sfantar wrote: I am at the moment trying to write on a script which gets the url between " in the . Unfortunately, I am not able to get them with my regexp. My regexp just only matches the lines containing the urls. After reading the docs about regexp, I can't ge

Re: Delete elements from an array

2006-04-18 Thread Tom Phoenix
On 4/18/06, Gallagher, Tim (NE) <[EMAIL PROTECTED]> wrote: > if(length($arry[$x]) < 0) Are you sure you want length() there? > delete($arry[$x]); I'm not sure you want delete() there; you may want splice(). > Here is the problem, I want to delete the 0's from the array and > know what index nu

Delete elements from an array

2006-04-18 Thread Gallagher, Tim \(NE\)
I want to delete elements from an array and get what number that is. Here is an example/ [code] use strict; use warnings; my @arry = (1,2,3,4,0,9,8,0,8,6,5,0,9,0,8,0,0,0,7,6,5,4,3,5,76,0,7,0,2,0,7,54,43,0); my $x = 0; while($x < scalar(@arry)) { if(length($arry[$x]) < 0) { delete

Re: perl help

2006-04-18 Thread Chas Owens
On 4/18/06, Irfan J Sayed <[EMAIL PROTECTED]> wrote: snip > can anybody plz tell me what i am doing wrong snip What you are doing wrong is making assumptions and not reading the documentation. This is being compounded by your inexperience with Perl. First let us tackle the Perl ignorance: true a

Re: beginner help

2006-04-18 Thread Dr.Ruud
"M K Scott" schreef: > I am trying to initialise an array with certain characters in it to > then match to user input but the '£' symbol is coming up in the > comparison as a funny looking 'u symbol with a squiggle above. Is > this due to me being inept at programming or my PC not understanding >

Re: Setting Content-Length Header In CGI.pm

2006-04-18 Thread Randal L. Schwartz
> ""Mike" == "Mike Martin" <[EMAIL PROTECTED]> writes: "Mike> I have a pair of scripts which take in up to 6 filefields, munge them "Mike> so path info remains and get sent to shell commands. "Mike> However after a certain amount of data I get a "Invalid "Mike> Content-Length" error and it bo

Re: parent / child PID / wait q

2006-04-18 Thread Joshua Colson
On Mon, 2006-04-17 at 16:11 -0700, Henry, Mark Patrick wrote: > Hi All, > > Hope this isn't off-topic.. > > I want to: > > *invoke multiple sub-jobs from a script, limited by the amount of > computers I have available/can send those jobs to. > *when I've launched as many jobs as I have machines,

Re: beginner help

2006-04-18 Thread Mr. Shawn H. Corey
On Tue, 2006-18-04 at 13:37 +0100, M K Scott wrote: > I am just starting out teaching myself Perl from books and web resources so I > apologise if my questions seems a little straight forward but I was hoping to > ask here to get clarification and so I hope my simple questions do not annoy > you

beginner help

2006-04-18 Thread M K Scott
I am just starting out teaching myself Perl from books and web resources so I apologise if my questions seems a little straight forward but I was hoping to ask here to get clarification and so I hope my simple questions do not annoy you all and that I have the right forum for these questions :)

Re: need help with format

2006-04-18 Thread John W. Krahn
Poonam Pahil wrote: > oops, > sorry.I had copied a table but i guess it did not show up in the mail. > > John, > by tabular format I mean getting a table as output. > I'll attach a word doc; maybe that'll explain what i want. > please see this attchment. Sorry, I don't own Word and even if I did

Re: dircopy Was: perl help

2006-04-18 Thread JupiterHost.Net
Bjørge Solli wrote: Please use more descriptive sibjects! I second that ;p And more info on where you're gettign reandom functions from :) [snip] But in variable $cp proper value is not coming .Either it should come as 0 or1 but it's coming as any junk value or no. Where in the documen

parent / child PID / wait q

2006-04-18 Thread Henry, Mark Patrick
Hi All, Hope this isn't off-topic.. I want to: *invoke multiple sub-jobs from a script, limited by the amount of computers I have available/can send those jobs to. *when I've launched as many jobs as I have machines, wait until one completes and send that machine another job, and so as others fr

Re: need help with format

2006-04-18 Thread Poonam Pahil
oops, sorry.I had copied a table but i guess it did not show up in the mail.   John, by tabular format I mean getting a table as output. I'll attach a word doc; maybe that'll explain what i want. please see this attchment.     On 4/18/06, John W. Krahn <[EMAIL PROTECTED]> wrote: Poonam Pahil wrote:

Re: need help with format

2006-04-18 Thread John W. Krahn
Poonam Pahil wrote: > Hi, Hello, > I want have an output in tabular format using perl . > Something like the following: > > * textx > texty > textz > text > text > > text > text > text > text > text > text > text > text > text > text > text > * > > > As much as i know perl h

need help with format

2006-04-18 Thread Poonam Pahil
Hi, I want have an output in tabular format using perl . Something like the following: * textx texty textz text text text text text text text text text text text text text * As much as i know perl has a format func that can help. Is there a better way. Help would be appreciat

Re: perl help

2006-04-18 Thread Chad Perrin
On Tue, Apr 18, 2006 at 03:17:15PM +0530, Irfan J Sayed wrote: > > my $cp = dircopy("D:\\vobs","D:\\backup"); > if ($cp == 0) > { > print " Copied successfuly\n"; > } > else > { > print " Copying failed\n"; > } > > But in variable $cp proper value is not coming .Either it should come as

Re: dircopy Was: perl help

2006-04-18 Thread Bjørge Solli
Please use more descriptive sibjects! On Tuesday 18 April 2006 11:47, Irfan J Sayed wrote: > my $cp = dircopy("D:\\vobs","D:\\backup"); > if ($cp == 0) unless($cp) # this will execute the first block if $cp is empty > { > print " Copied successfuly\n"; > } > else > { > print " Copying

Re: sorting an array of arrays by arr_el[$idx][2] (or something like that)

2006-04-18 Thread John W. Krahn
Charles K. Clarkson wrote: > Ed wrote: > > : push( @lineArray, @_ ); <---no it's an array of arrays. > > An array of arrays is a short name for an array of array > references. Array elements can only hold scalar values and arrays > are not scalars. References to arrays are scalars.

Re: sorting an array of arrays by arr_el[$idx][2] (or something like that)

2006-04-18 Thread John W. Krahn
Thomas Bätzler wrote: > Ed <[EMAIL PROTECTED]> asked: >> >> push( @lineArray, @_ ); <---no it's an array of arrays. > > This will append all the items in @_ to @lineArray. > > You shoul've said "push( @lineArray, [EMAIL PROTECTED] );" instead. No he shouldn't have. @_ is a global

How to get the argument of the ?

2006-04-18 Thread sfantar
I am at the moment trying to write on a script which gets the url between " in the . Unfortunately, I am not able to get them with my regexp. My regexp just only matches the lines containing the urls. After reading the docs about regexp, I can't get the urls themselves. Thanks for you help. -

perl help

2006-04-18 Thread Irfan J Sayed
Hi, I am executing following command my $cp = dircopy("D:\\vobs","D:\\backup"); if ($cp == 0) { print " Copied successfuly\n"; } else { print " Copying failed\n"; } But in variable $cp proper value is not coming .Either it should come as 0 or1 but it's coming as any junk value or no.

Re: sorting an array of arrays by arr_el[$idx][2] (or something like that)

2006-04-18 Thread M. Kristall
Ed wrote: I want to sort the lines in the file by the 3rd column (Field, Internal, CM, DocAdmin) Since Perl doesn't really support multidimensional arrays but instead uses references, something like this should work: sort { $$a[2] cmp $$b[2] } @array; This is more or less like the typical sort