Re: printing array elements in columns

2004-06-21 Thread Zeus Odin
"Guruguhan N" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi All, Hello. Please read Charles K. Clarkson's comments. They are spot on. I will not repeat them here. > In reply to my own posting, I have written a code like the one given below. > @X = (1 .. 30) > $n_el = scala

Re: List as a value of a hash???

2004-06-21 Thread Scott Stearns
On 21 Jun 2004, you wrote in perl.beginners: > Have a question regarding hashes. Lets say I wanted a list as one of > the values in my hash for the reason that I would want to constantly > push values into that list. .. > $dataHash{"$fileName"}{count} = 1; > $dataHash{"$fileName"}{increment} = pus

Re: Fwd: loop nested foreach

2004-06-21 Thread Gunnar Hjalmarsson
Mike Re-V wrote: Note: forwarded message attached. Subject: loop nested foreach From: "re-v" <[EMAIL PROTECTED]> Date: Mon, 21 Jun 2004 16:03:02 -0400 To: You forwarded a private message with my real address to a mailing list whose messages are also sent to Usenet. I would very much appreciate i

Re: Fwd: loop nested foreach

2004-06-21 Thread Roberto Etcheverry
mike re-v wrote: Note: forwarded message attached. __ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail Subject: loop nested foreach Fr

Re: Pattern match

2004-06-21 Thread Chris Charley
- Original Message - From: "Naser Ali" <[EMAIL PROTECTED]> Newsgroups: perl.beginners To: <[EMAIL PROTECTED]> Sent: Monday, June 21, 2004 3:52 PM Subject: Pattern match > Hello, > > I have an array which was created by slurrping a whole text file. There are > certain element in the arra

Re: List as a value of a hash???

2004-06-21 Thread Roberto Etcheverry
Trina Espinoza wrote: Have a question regarding hashes. Lets say I wanted a list as one of the values in my hash for the reason that I would want to constantly push values into that list. .. $dataHash{"$fileName"}{count} = 1; $dataHash{"$fileName"}{increment} = push(@array,$fileNumber); ###PROBL

Re: Pattern match

2004-06-21 Thread Roberto Etcheverry
It's difficult to answer if you do not post the code with some input to test it, but lets suppose you have this: my @array; @array = ; # slurp whole file Then is easy to get what you want: my @lines_with_single_word = grep /^\s*\S+\s*$/,array; # ^\s*\S+\s*$ means beginning of line, 0 or more wh

Re: Pattern match

2004-06-21 Thread Gunnar Hjalmarsson
Naser Ali wrote: I have an array which was created by slurrping a whole text file. There are certain element in the array after reading the files which contain only one word. I want to only match those array elements which contain a single word and print it. You need to anchor the word to both the

Fwd: loop nested foreach

2004-06-21 Thread mike re-v
Note: forwarded message attached. __ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail --- Begin Message --- the idea here is to step thru a file named file.dat and extract part of each record {

Re: Answering Questions

2004-06-21 Thread Gunnar Hjalmarsson
Tim Johnson wrote: Gunnar Hjalmarsson wrote: Tim Johnson wrote: Chetak Sasalu wrote: That is one way to do it, but maybe you should tell him what it is that the regex does. I remember from my newbie days that it wasn't too useful when people just threw regexes at me without explaining them becau

Pattern match

2004-06-21 Thread Naser Ali
Hello, I have an array which was created by slurrping a whole text file. There are certain element in the array after reading the files which contain only one word. I want to only match those array elements which contain a single word and print it. Tried every thing but in vain. I must be doing s

Answering Questions [WAS:RE: split]

2004-06-21 Thread Tim Johnson
I didn't say that Chetak's reply was wrong, or that he was somehow remiss in omitting that information. It is, in the end, a somewhat philosophical difference, and as such I won't presume to try to change your mind, but let me clarify my point. The OP was given a finished product. I certainly

List as a value of a hash???

2004-06-21 Thread Trina Espinoza
Have a question regarding hashes. Lets say I wanted a list as one of the values in my hash for the reason that I would want to constantly push values into that list. .. $dataHash{"$fileName"}{count} = 1; $dataHash{"$fileName"}{increment} = push(@array,$fileNumber); ###PROBLEM HERE! $dataHash{"$f

RE: Using regular expression as a variable.

2004-06-21 Thread BOLCATO CHRIS (esm1cmb)
Hello, >Hi, >I'm having a problem where somehow a regexp does not work and the program results in an error >when the regexp is called using a variable. >Here is my code. >1 $filename = 'This is a directory\file\sub.txt'; >2 $regex = '\\(\w+\.\w+)$'; >3 if ($filename =~ /$regex/) >4 {print $1;} e

RE: Using regular expression as a variable.

2004-06-21 Thread Khan, Ahmer H
Thank you for replying. The only thing is that when I shouldn't be escaping the right paren since they indicate the variable $1 to be printed below. I tried escaping the paren but it results in a nonmatch. Could you let me know if I am looking at it incorrectly? Thanks again. Ahmer -Original

perl.beginners Weekly list FAQ posting

2004-06-21 Thread casey
NAME beginners-faq - FAQ for the beginners mailing list 1 - Administriva 1.1 - I'm not subscribed - how do I subscribe? Send mail to <[EMAIL PROTECTED]> You can also specify your subscription email address by sending email to (assuming [EMAIL PROTECTED] is your email address):

Re: Using regular expression as a variable.

2004-06-21 Thread Anders Holm
Hi. See inline comments.. [snip] Here is my code. 1 $filename = 'This is a directory\file\sub.txt'; 2 $regex = '\\(\w+\.\w+)$'; $regex = '\\(\w+\.\w+\)$'; Missed to escape the last ) ... [snip] However if I "copy/paste" the actual regexp from line 2 into line 3 and not use the variable, the program

Using regular expression as a variable.

2004-06-21 Thread Khan, Ahmer H
Hi, I'm having a problem where somehow a regexp does not work and the program results in an error when the regexp is called using a variable. Here is my code. 1 $filename = 'This is a directory\file\sub.txt'; 2 $regex = '\\(\w+\.\w+)$'; 3 if ($filename =~ /$regex/) 4 {print $1;} else 5 {print "no

Re: split

2004-06-21 Thread Gunnar Hjalmarsson
Tim Johnson wrote: Chetak Sasalu wrote: $var =~ m/Owner: (\w{5})\s*: rwx \(all\)/; $y = $1; That is one way to do it, but maybe you should tell him what it is that the regex does. I remember from my newbie days that it wasn't too useful when people just threw regexes at me without explaining them

RE: printing array elements in columns

2004-06-21 Thread Charles K. Clarkson
N, Guruguhan (GEAE, Foreign National, EACOE) <> wrote: : In reply to my own posting, I have written a code : like the one given below. : : @X = (1 .. 30); : : $n_el = scalar(@X); : $n_row = $n_el/3; # 3 is the number of columns I want. : : for ($i=0; $i<$n_row; $i++) { : f

RE: Why are timelocal() and localtime() not exactly opposite?

2004-06-21 Thread Bob Showalter
Zeus Odin wrote: > ... > # localtime cannot handle year 1903, but timelocal can Short answer is that the epoch started in 1970, so 1903 is "out of range" for the purposes of localtime(). Don't use epoch seconds for storing historical dates like birth dates, etc. -- To unsubscribe, e-mail: [EMAI

RE: split

2004-06-21 Thread Tim Johnson
That is one way to do it, but maybe you should tell him what it is that the regex does. I remember from my newbie days that it wasn't too useful when people just threw regexes at me without explaining them because they look so daunting before you are used to them. -Original Message

RE: script

2004-06-21 Thread Tim Johnson
What have you tried? Are you stumped, are you trying to learn, or are you just trying to get people to write scripts for you? When you ask a question, you should include what you have done so that people can give you answers that match the level of experience you have and so that they know the

checkbuttons

2004-06-21 Thread Charlene Gentle
Hi YES I know the code is really bad.but How can I create a group of checkbuttons, that will act independand but call the same sub. Something like : $bs[1] = $opbtFrm->Checkbutton(-text=>"Spasie",-background=>'gray',-padx=>10, -offvalue => 0,-onvalue => 1,-variable => {\$cb_value

RE: split

2004-06-21 Thread chetak.sasalu
HI all, HI, I want to grep only from $var , i want in a variable $y. $var="Owner: X : rwx (all)"; $var =~ m/Owner: (\w{5})\s*: rwx \(all\)/; $y = $1; Chetak -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

script

2004-06-21 Thread Vema Venkata
> > Hi , > > TIA > > Need help > > I have a following path > > "/proj/ahd02/CAisd/site/mods/scripts/log" in this path i have a file called > "archive-18-7-2003.tar.Z" > > I want a script in perl by uncompress and untar it. > > can any send me the

Re: split

2004-06-21 Thread Prasanna Kothari
have a look at the split function: perldoc -f split or http://www.perldoc.com/perl5.8.4/pod/func/split.html @arr = split(/:/ ,$var); $x = $arr[1]; --Prasanna jack jack wrote: Hi All, I need help in greping only Y from $var , the output should be in variable $x. $var=Owner: Y : r

Re: split

2004-06-21 Thread Anders Holm
Jack Jack, how does this differ from your last mail (apart from naming conventions) ?? Is this homework perhaps? Sounds like it... There's some excellent resources on the web, but most notably they also tend to come with your distribution of Perl. perldoc perlre is one of those... HTH! //Anders//

split

2004-06-21 Thread jack jack
HI all, I want to grep only from $var , i want in a variable $y. $var="Owner: X : rwx (all)"; How to split it? rgds j - Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers!

split

2004-06-21 Thread jack jack
Hi All, I need help in greping only Y from $var , the output should be in variable $x. $var=Owner: Y : rwx (all) rgds jack - Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages!

RE: printing array elements in columns

2004-06-21 Thread N, Guruguhan \(GEAE, Foreign National, EACOE\)
Hi All, In reply to my own posting, I have written a code like the one given below. Let @X = (1 .. 30) $n_el = scalar(@X); $n_row = $n_el/3; # 3 is the number of columns I want. for ($i=0; $i<$n_row; $i++) { for ( $j=$i; $j <$n_el; $j+=$n_row) { printf ( "%4d\t