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 http://www.roth.n

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 = : @<<

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'); > > fo

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? Woul

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

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

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 h

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

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 cr

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]

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; $pcname<3000; $pcname++) { $lupath = "$pcnames\\admin\$\\W2HCM

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 }

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 re

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. > > Som

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:\temp>perl -pi.bak -e "s/\s+/,/g" tempfile.out > >C:\temp>more < 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 th

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: 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:\temp>perl -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+

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:\temp>perl -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:\temp>more < tempfile.

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

2004-03-12 Thread Distribution Lists
Thanks but I've that already try that C:\temp>perl -pi.bak -e "s/\s+/,/g" tempfile.out C:\temp>more < 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 fiel

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 stat

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 her

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: 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: 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 Program

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-d

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 Server,Drive

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 ( ) { > > chomp; > > print scalar reverse, "\n"; > > } > > > > __END__ > > Looks cool, and perfe

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 warn

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 until

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 : ACME000

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 state

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] Sen

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 process

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

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 PROTEC

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]

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 files,

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" LU$=Rea

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 .

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 suf

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: 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

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: 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 can

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: 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. Howeve

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 th

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 open

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 spli

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

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 PROT

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 = spl

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 homewor

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

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 rev

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 low

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

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