RE: Adding Arrays as Hash Keys

2004-06-19 Thread Charles K. Clarkson
From: gohaku wrote: : I would like to know if there is a cleaner way of Merging : Hash Keys with Arrays and what the correct terminology is : for describing this merging. : I find the syntax somewhat confusing since @ usually refers : to an Array while : % refers to a Ha

Adding Arrays as Hash Keys

2004-06-19 Thread gohaku
Hello everyone, I would like to know if there is a cleaner way of Merging Hash Keys with Arrays and what the correct terminology is for describing this merging. I find the syntax somewhat confusing since @ usually refers to an Array while % refers to a Hash @array = qw(1 2 3 4 5); #Hash Key and

RE: Variables in qw?

2004-06-19 Thread Charles K. Clarkson
gohaku <[EMAIL PROTECTED]> wrote: : Hi everyone, : I was just curious if there is someway to add a : variable when using qw. I am trying to do the : following: [snip] my $foo = 'bar'; my @arr = ( qw(foo bar), $foo ); HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 -- To

Ways to Sort Returned Array?

2004-06-19 Thread gohaku
Hello everyone, I am trying to sort an array returned by a subroutine. I realize it would be better if the subroutine returns a Sorted Array instead of Sorting the Returned Array, however I would like to know why sort doesn't work on a Returned Array and why the returned array has to be parenthesiz

RE: Regexp

2004-06-19 Thread Tim Johnson
And for #2, how about: s/\b\w{1,2}\b//g; -Original Message- From: Mandar Rahurkar [mailto:[EMAIL PROTECTED] Sent: Saturday, June 19, 2004 5:48 PM Cc: [EMAIL PROTECTED] Subject: Regexp 2. removing all one and two lettered words e.g., a,an -- To unsubscribe, e-mail: [EMAIL PROTE

RE: Regexp

2004-06-19 Thread Tim Johnson
What about: $string =~ s/s\b//g; -Original Message- From: Mandar Rahurkar [mailto:[EMAIL PROTECTED] Sent: Saturday, June 19, 2004 8:06 PM To: Tim Johnson Cc: [EMAIL PROTECTED] Subject: RE: Regexp Hi, I am too old to have homeworks on perl :) I tried for the first case: s/\ws\b/$1/;

RE: Regexp

2004-06-19 Thread Mandar Rahurkar
Hi, I am too old to have homeworks on perl :) I tried for the first case: s/\ws\b/$1/; but trick to understand is that I need to substitute forests with forest. I can probably use substr however was looking for a elegant solution. Mandar On Sat, 19 Jun 2004, Tim Johnson wrote: > > This so

RE: Regexp

2004-06-19 Thread Tim Johnson
This sounds like a homework project. We don't generally do people's homework for them. If I'm wrong, I apologize. Maybe you can tell us what you've tried so far. Have you read through 'perldoc perlre'? I would recommend the module YAPE::Regex::Explain if you want some help figuring out what y

Regexp

2004-06-19 Thread Mandar Rahurkar
Hi All, what wud be the regexp for : 1. substituting last s of every word e.g., forests become forest, goats becomes goat 2. removing all one and two lettered words e.g., a,an Thanks, Mandar -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL P

Variables in qw?

2004-06-19 Thread gohaku
Hi everyone, I was just curious if there is someway to add a variable when using qw. I am trying to do the following: #Testing qw $string_variable = "abc"; @array = qw( string_literal1 string_literal2 $string_variable ) print join(" ",@array); #Would like to see: #string_literal1 string_literal

Re: Re:seach a number in a file

2004-06-19 Thread Chris Charley
- Original Message - From: "Jorge Goncalves" <[EMAIL PROTECTED]> Newsgroups: perl.beginners To: <[EMAIL PROTECTED]> Sent: Friday, June 18, 2004 4:35 AM Subject: Re:seach a number in a file > Hi, I have a text file like this: [snip file contents, they're posted below] > How can i do in

Re: puzzled

2004-06-19 Thread Chris Charley
- Original Message - From: "Pedro Antonio Reche" <[EMAIL PROTECTED]> Newsgroups: perl.beginners To: <[EMAIL PROTECTED]> Sent: Friday, June 18, 2004 9:43 AM Subject: puzzled > Hi there, I am puzzled by the 'build_seq' subroutine in following code. > #!/usr/sbin/perl -w > use strict; > us