Re: Reading text file in reverse order

2004-03-12 Thread R. Joseph Newton
Mame Mbodji wrote: This is a hwk, but I never asked for a complete answer 1. The term homework refers to something fluid, rather than discrete, and therefore does not take an article ['a' or 'the'] 2. Please do not abbreviate words, unless the abbreviation is a very standard one. I wasted

RE: Nucleotide Sequencing

2004-03-12 Thread Bill Akins
-Original Message- From: Daniel T. Staal [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 10, 2004 8:11 PM To: Perl Beginners Cc: Sumit Kaur Subject: RE: Nucleotide Sequencing --As of Wednesday, March 10, 2004 6:29 PM -0600, Charles K. Clarkson is alleged to have said:

Re: can somebody tell me what this means

2004-03-12 Thread sam lehman
On Thu, 11 Mar 2004 11:07:24 +0100, Ralf Schaa [EMAIL PROTECTED] wrote: sam lehman wrote: i got his code from a program i found, and i was wondering that the ? and the : are for? $target = (@digits % 2) ? ($digits[int(@digits/2)]) : ([EMAIL PROTECTED]/2-1]); conditional statement (with

Re: Reading text file in reverse order

2004-03-12 Thread John W. Krahn
[EMAIL PROTECTED] wrote: I have a text file with 5 or more lines as in: My name is this and that I live in Denver Colorado I live in washington I live in Denver Virginia I am trying to read this file and print each line and each word in reverse order as in: ainigriv revned ni evil

Re: Reading text file in reverse order

2004-03-12 Thread Mame Mbodji
Thanks for the advice, I will try HARDER and repost if I cannot figure it out! R. Joseph Newton wrote: Mame Mbodji wrote: This is a hwk, but I never asked for a complete answer 1. The term homework refers to something fluid, rather than discrete, and therefore does not take an article

Re: Reading text file in reverse order

2004-03-12 Thread Mame Mbodji
Thank you so that. This is the kind of advice I have been expecting. This is very helpful and I think I will be able to figure it out now. I never intended for the group to do my HMW. I have been with this list for over a year and I learned a lot, but I never posted a question related to my

Re: help with a regex and greediness

2004-03-12 Thread Stuart White
I like the idea of using split() but decided to keep most of my regex and incorporate split on the string. So the string: 'Spurs 94, Suns 82' -and there may or may not be a space after the 2. I decided to read up on split(), and then try to split it. This is what I came up with: @teamscores =

Re: help with a regex and greediness

2004-03-12 Thread Paul Johnson
Stuart White said: I'm not sure what's going wrong here. Can someone tell me how I can split 'Spurs 94, Suns 82' into: array[0] == 'Spurs' and array[1] == 'Suns' @array = /([[:alpha:]]+)/g; -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL

Re: Reading text file in reverse order

2004-03-12 Thread R. Joseph Newton
John W. Krahn wrote: [EMAIL PROTECTED] wrote: I have a text file with 5 or more lines as in: My name is this and that I live in Denver Colorado I live in washington I live in Denver Virginia I am trying to read this file and print each line and each word in reverse order as

Re: help with a regex and greediness

2004-03-12 Thread Randy W. Sims
On 03/12/04 08:18, Stuart White wrote: I like the idea of using split() but decided to keep most of my regex and incorporate split on the string. So the string: 'Spurs 94, Suns 82' -and there may or may not be a space after the 2. I decided to read up on split(), and then try to split it. The

how to make sure, that the script is running one time?

2004-03-12 Thread Christian Stalp
Hello together, I have a question regarding process-control. I want to write a perl script which must not running in more than one process in the same time. The script creates a directory copys a zip-file in it, unpack it and reads every file in this package. However, the files must not get

Re: help with a regex and greediness

2004-03-12 Thread Stuart White
--- Randy W. Sims [EMAIL PROTECTED] wrote: On 03/12/04 08:18, Stuart White wrote: I like the idea of using split() but decided to keep most of my regex and incorporate split on the string. So the string: 'Spurs 94, Suns 82' -and there may or may not be a space after the 2. I decided

RE: how to make sure, that the script is running one time?

2004-03-12 Thread Bob Showalter
Christian Stalp wrote: Hello together, I have a question regarding process-control. I want to write a perl script which must not running in more than one process in the same time. The script creates a directory copys a zip-file in it, unpack it and reads every file in this package. However,

Re: how to make sure, that the script is running one time?

2004-03-12 Thread James Edward Gray II
On Mar 12, 2004, at 9:06 AM, Christian Stalp wrote: Hello together, I have a question regarding process-control. I want to write a perl script which must not running in more than one process in the same time. The script creates a directory copys a zip-file in it, unpack it and reads every file

Re: Improving performance when working with large text files

2004-03-12 Thread Shiping Wang
At 07:55 PM 3/11/2004 -0600, James Edward Gray II wrote: On Mar 11, 2004, at 10:41 AM, Price, Jason wrote: I'm trying to optimize a script used for processing large text log files (around 45MB). I think I've got all the processing fairly well optimized, but I'm wondering if there's anything I

Install Curses for Bastille Install

2004-03-12 Thread Paul Kraus
When ever I try and install Curses Perl -MCPAN -e install Cures its fails. I can't seem to figure out why. This is on a brand new install of fedora core 1. Here is the output Long --- CPAN: Storable loaded ok Going to read /root/.cpan/Metadata Database was generated on Thu, 11

Re: how to make sure, that the script is running one time?

2004-03-12 Thread Randal L. Schwartz
Christian == Christian Stalp [EMAIL PROTECTED] writes: Christian I have a question regarding process-control. I want to Christian write a perl script which must not running in more than one Christian process in the same time. The script creates a directory Christian copys a zip-file in it,

RE: Improving performance when working with large text files

2004-03-12 Thread Bob Showalter
Price, Jason wrote: I'm trying to optimize a script used for processing large text log files (around 45MB). I think I've got all the processing fairly well optimized, but I'm wondering if there's anything I can do to speed up the initial loading of the file. Currently, I'm performing

RE: Improving performance when working with large text files

2004-03-12 Thread West, William M
Price, Jason wrote: I'm trying to optimize a script used for processing large text log files (around 45MB). I think I've got all the processing fairly well optimized, but I'm wondering if there's anything I can do to speed up the initial loading of the file. oh the pain and suffering of

Win32::AdminMisc

2004-03-12 Thread Meneses, Alden
I'm getting this error when I try to execute this script use Win32::AdminMisc; path$=\\cpws0073\winnt\W2HCM.INI LU$=ReadINI( path$ [, MS SNANT [, Term}}) print LU$ Can't locate Win32/AdminMisc.pm in @INC (@INC contains: C:\Program Files\ActiveState Komodo 2.5 C:/Perl/lib C:/Perl/site/lib .) I

FW: Win32::AdminMisc

2004-03-12 Thread Meneses, Alden
Was able to download from www.roth.net -Original Message- From: Meneses, Alden Sent: Friday, March 12, 2004 10:41 AM To: [EMAIL PROTECTED] Subject: Win32::AdminMisc I'm getting this error when I try to execute this script use Win32::AdminMisc; path$=\\cpws0073\winnt\W2HCM.INI

RE: Read from tape device

2004-03-12 Thread Jakob Kofoed
Hi again, Sorry for the delayed answer. Thank you for all your comments (Yes Joseph, I will try to enhance my basic abilities - sorry for the bad code:-) My thoughts on this project was to make a perl script which copy the content of a tape to disk, no matter if it is tar archives, binary

How do I increment a alphanumeric value?

2004-03-12 Thread Meneses, Alden
Suppose I have machines that are ACME I want to go from ACME0001 to ACME -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Re: How do I increment a alphanumeric value?

2004-03-12 Thread James Edward Gray II
On Mar 12, 2004, at 1:39 PM, Meneses, Alden wrote: Suppose I have machines that are ACME I want to go from ACME0001 to ACME How's this? foreach (1..) { printf ACME%4d\n, $_; } James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

RE: How do I increment a alphanumeric value?

2004-03-12 Thread Wagner, David --- Senior Programmer Analyst --- WGO
James Edward Gray II wrote: On Mar 12, 2004, at 1:39 PM, Meneses, Alden wrote: Suppose I have machines that are ACME I want to go from ACME0001 to ACME How's this? If you have it in a variable then you only need ++ to get to the next item: my $MyMachines =

Way to create Windows Services.

2004-03-12 Thread Viraj Purang
Is there a PERL API using which I can create wrapper windows services around batch files. I need to be able to stop and start a set of Java commands. People in my company have already made start scripts for these Java commands. However the stop scripts and /or APIs that would STOP Java

RE: How do I increment a alphanumeric value?

2004-03-12 Thread Meneses, Alden
I must be doing something wrong with this script my $pcname = 'ACME0001'; while ( $pcname 5 ) { print $pcname \n; $pcname++; } I get these results ACME0001 1 2 3 4 -Original Message- From: Wagner, David --- Senior Programmer Analyst --- WGO [mailto:[EMAIL PROTECTED] Sent:

RE: How do I increment a alphanumeric value?

2004-03-12 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Meneses, Alden wrote: I must be doing something wrong with this script my $pcname = 'ACME0001'; while ( $pcname 5 ) { I believe it has to do the arithmetic which is making ACME0001 into 0 which then gets added to 0. This is the code I used to verify it would work as stated: my

RE: How do I increment a alphanumeric value?

2004-03-12 Thread Charles K. Clarkson
Wagner, David --- Senior Programmer Analyst --- WGO [EMAIL PROTECTED] wrote: : : Meneses, Alden wrote: : I must be doing something wrong with this script : : my $pcname = 'ACME0001'; : while ( $pcname 5 ) { : I believe it has to do the arithmetic which is making : ACME0001 into

second-level string interpolation

2004-03-12 Thread Michael C. Davis
Hi, Apologies if I'm bringing up a repeated topic. I searched the list archive and the web and nothing specific has turned up so far. Is there a way to defer evaluation of the contents of a here-doc-defined value such that one can embed variables in the here-doc and not have them evaluated

Re: second-level string interpolation

2004-03-12 Thread david
Michael C. Davis wrote: Is there a way to defer evaluation of the contents of a here-doc-defined value such that one can embed variables in the here-doc and not have them evaluated until they are used later? Something like this: code: - use strict; use warnings;

Re: Reading text file in reverse order

2004-03-12 Thread John W. Krahn
R. Joseph Newton wrote: John W. Krahn wrote: use File::ReadBackwards; tie *FILE, 'File::ReadBackwards', $file or die Cannot open $file: $!; while ( FILE ) { chomp; print scalar reverse, \n; } __END__ Looks cool, and perfectly tailored to the task. How

Regular expression to replace whitespace with comma

2004-03-12 Thread Distribution Lists
Can someone please tell what regular expression would change Server Drive FSTYPE Size Free Used SERVER1 C$ NTFS4095 296 3799 SERVER2 D$ NTFS4001 1908 2093 SERVER3 C$ NTFS 38123 29811 8312 to

RE: second-level string interpolation

2004-03-12 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Michael C. Davis wrote: Hi, Apologies if I'm bringing up a repeated topic. I searched the list archive and the web and nothing specific has turned up so far. Is there a way to defer evaluation of the contents of a here-doc-defined value such that one can embed variables in the here-doc

RE: How do I increment a alphanumeric value?

2004-03-12 Thread Meneses, Alden
Did anyone metion that you guys are good. I see my mistake. I didn't separate the 2 variables. I really need to read up on my programming. :) I will post my final script that everyone has generously helped me with. Thanks again. -Original Message- From: Wagner, David --- Senior

Re: Regular expression to replace whitespace with comma

2004-03-12 Thread James Edward Gray II
On Mar 12, 2004, at 2:55 PM, Distribution Lists wrote: Can someone please tell what regular expression would change Server Drive FSTYPE Size Free Used SERVER1 C$ NTFS4095 296 3799 SERVER2 D$ NTFS4001 1908 2093 SERVER3 C$

Re: second-level string interpolation

2004-03-12 Thread Randy W. Sims
On 03/12/04 16:35, david wrote: Michael C. Davis wrote: Is there a way to defer evaluation of the contents of a here-doc-defined value such that one can embed variables in the here-doc and not have them evaluated until they are used later? Something like this: code: - use strict;

Re: second-level string interpolation

2004-03-12 Thread John W. Krahn
Michael C. Davis wrote: Hi, Apologies if I'm bringing up a repeated topic. I searched the list archive and the web and nothing specific has turned up so far. Is there a way to defer evaluation of the contents of a here-doc-defined value such that one can embed variables in the here-doc

Re: second-level string interpolation

2004-03-12 Thread Randy W. Sims
On 03/12/04 16:08, Randy W. Sims wrote: To elaborate a bit, the reason for the failure is that while the string is interpolated, it is then also evaluated as perl code, so in my $header = 'end_of_header'; # File: $filename end_of_header my $filename = 'xyz'; print eval $header; the last

[Fwd: Re: Regular expression to replace whitespace with comma]

2004-03-12 Thread Distribution Lists
Thanks but I've that already try that C:\tempperl -pi.bak -e s/\s+/,/g tempfile.out C:\tempmore tempfile.out Server,Drive,FSTYPE,Size,Free,Used,SERVER1,C$,NTFS,4095,296,3799,SERVER1,D$,NTFS,4001,1908,2093,SERVER1,C$,NTFS,38123,29808,8315, The only thing that is missing is that after field 6

Re: Regular expression to replace whitespace with comma

2004-03-12 Thread James Edward Gray II
On Mar 12, 2004, at 3:19 PM, Distribution Lists wrote: Thanks but I've that already try that C:\tempperl -pi.bak -e s/\s+/,/g tempfile.out Add the -l switch to that to chomp the newline and replace it when it prints: perl -pli.bak -e s/\s+/,/g tempfile.out James C:\tempmore tempfile.out

Re: Regular expression to replace whitespace with comma

2004-03-12 Thread Distribution Lists
That worked great! Thanks Darryl On Mar 12, 2004, at 3:19 PM, Distribution Lists wrote: Thanks but I've that already try that C:\tempperl -pi.bak -e s/\s+/,/g tempfile.out Add the -l switch to that to chomp the newline and replace it when it prints: perl -pli.bak -e s/\s+/,/g

date format using localtime()

2004-03-12 Thread Jeff Westman
Is there a way in perl to get the month/day/year using localtime WITHOUT using 'use POSIX qw(strftime)' or a system date call. Something using slices, maybe something like: print scalar ((localtime(time))[4,3,7]) expecting the result to be 03122004. Trivial question, thanks in advance.

Re: [Fwd: Re: Regular expression to replace whitespace with comma]

2004-03-12 Thread Jan Eden
Distribution Lists wrote: Thanks but I've that already try that C:\tempperl -pi.bak -e s/\s+/,/g tempfile.out C:\tempmore tempfile.out Server,Drive,FSTYPE,Size,Free,Used,SERVER1,C$,NTFS,4095,296,3799,SERVER1,D$,NTFS ,4001,1908,2093,SERVER1,C$,NTFS,38123,29808,8315, The only thing that is

Re: date format using localtime()

2004-03-12 Thread Steve Mayer
Jeff, Check out http://www.users.voicenet.com/~corr/macsupt/macperl/localtime.html Steve On Fri, Mar 12, 2004 at 01:38:28PM -0800, Jeff Westman wrote: Is there a way in perl to get the month/day/year using localtime WITHOUT using 'use POSIX qw(strftime)' or a system date call.

Re: date format using localtime()

2004-03-12 Thread Owen Cook
On Fri, 12 Mar 2004, Jeff Westman wrote: Is there a way in perl to get the month/day/year using localtime WITHOUT using 'use POSIX qw(strftime)' or a system date call. Something using slices, maybe something like: print scalar ((localtime(time))[4,3,7]) expecting the result to

Re: second-level string interpolation

2004-03-12 Thread david
Randy W. Sims wrote: I just realized that this might be a little misleading. If you break it down to: my $result = eval $header; print $result; You will get an uninitialized value error. What happens is that eval $header is first interpolated to eval { # File: xyz } which is

reading .ini values

2004-03-12 Thread Meneses, Alden
Ok.. Thanks to everyone's help. Here is the script I ended up with. use Win32::AdminMisc; $file = 'c:\temp\lurecover.txt'; open (OUT, $file) || die cannot append $file: $!; my $pcnames = 'ACME0001'; for ( my $pcname = 0; $pcname3000; $pcname++) { $lupath = $pcnames\\admin\$\\W2HCM.INI;

Re: second-level string interpolation

2004-03-12 Thread Michael C. Davis
Thanks everyone for the great ideas. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Re: not getting the syntax

2004-03-12 Thread Charlotte Hee
On Thu, 11 Mar 2004, John W. Krahn wrote: Date: Thu, 11 Mar 2004 16:33:00 -0800 From: John W. Krahn [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: not getting the syntax Charlotte Hee wrote: Hello, Hello, I'm looking at the perl cookbook example on how to create a record

Re: not getting the syntax

2004-03-12 Thread John W. Krahn
Charlotte Hee wrote: On Thu, 11 Mar 2004, John W. Krahn wrote: Charlotte Hee wrote: I tried the following but it doesn't work and gives an error. $byname { $record-{Jason}-PHONE } = '999-'; # error undefined val I keep looking at the syntax but it's not sinking in.

Re: can somebody tell me what this means

2004-03-12 Thread R. Joseph Newton
sam lehman wrote: so would: something ? dosomething : somethingelse ? dosomethingelse : killyourself be the same as Let's not go there--at least not yet. NOt that I object to suicide particularly, y'know dff'runt strokes fer diff'runt folks an' all, but nesting conditionals before you have

chown-ing symlink

2004-03-12 Thread Ohad Ohad
chown seems to be able only to follow links and change the destination. Anyway to change the link itself, I wouldn't want to run system(chown -h $file) . . . I'm using various unix machine (Linux, SunOs etc.) _ Tired of spam? Get

Print Format Problem

2004-03-12 Thread Jeff Borders
I've written a trivial program to print avery labels. One that allows me to specify how many rows to print (when I don't need 30 labels). The problem is that I don't want to print a blank line on a 3 line label. I thought the ~ would take care of this in format, but no. I've also tried using

Re: help with a regex and greediness

2004-03-12 Thread R. Joseph Newton
Stuart White wrote: Wow, yeah that helps a lot. Here's a question: If if had: $line = 'Spurs 94, Suns 82, Heat 99, Magic 74' and then did a split on comma and comma's surrounding spaces: @result = split (/\s*,\s*/, $line); result? How specific is result to the issue at hand? Would not

Re: not getting the syntax

2004-03-12 Thread R. Joseph Newton
Charlotte Hee wrote: For a single record I can see how that works but let's say I have 4 or 5 employees and I have the employee information for each one (assumed). Now I want to build a record for each employee in a loop like this: @names = ('Jason','Aria','Samir','Owen'); foreach

RE: Print Format Problem

2004-03-12 Thread Charles K. Clarkson
Jeff Borders [EMAIL PROTECTED] wrote: : : : I thought the ~ would take care of this in format, but no. I've also : tried using printf without a format block, but couldn't figure out how : to left justify the strings. [snip] : # Print Format Definitions : : format STDOUT = : @@ @ : $name,

Re: FW: Win32::AdminMisc

2004-03-12 Thread R. Joseph Newton
Meneses, Alden wrote: Was able to download from www.roth.net Please don't top-post. Better to PPM for it. That tool is built into the ActiveState distribution. You might wish to add a couple sites to the repository: rep add Jenda http://Jenda.Krynicky.cz/perl rep add Roth