time

2001-05-29 Thread Rob
Howdy all! Could anyone help me out with my time problem please? I want to get the current time in this format: DD-MM- HH:MI AM These are the three methods I have been testing. Method One my $perltime = time(); my $time = time2str($perltime); printf "Time is $time"; OUTPUT T

Re: help with regex

2001-05-29 Thread $Bill Luebkert
Jaime Teng wrote: > > Hi, > > Below is a test script im working on: > > ## > $input = '[EMAIL PROTECTED]'; > $line = '(.*)@abc.com=$[EMAIL PROTECTED]'; > ($left,$right) = split '=', $line,2; > $input =~ s/$left/$right/; > print $input; > > results -> \[EMAIL PROTECT

help with regex

2001-05-29 Thread Jaime Teng
Hi, Below is a test script im working on: ## $input = '[EMAIL PROTECTED]'; $line = '(.*)@abc.com=$[EMAIL PROTECTED]'; ($left,$right) = split '=', $line,2; $input =~ s/$left/$right/; print $input; results -> \[EMAIL PROTECTED] <- wrong it should be [EMAIL PROTECTED]

Win32::AdminMisc

2001-05-29 Thread Christopher L. Severson
Everyone, I am looking to use this module for either the 'CreateProcessAsUser' ability, or the 'LogonAsUser' ability. What I am trying to accomplish is having a Perl program called during the logon process that installs a patch (admin rights needed for the install) - once the patch is comple

Re: directory

2001-05-29 Thread $Bill Luebkert
Tanya Graham wrote: > > i don't think it is finding the files in the directory...when i hardcoded a > PRINT to one of the files in the directory it appended it. here's another > little problem...the Seek function SEEMS to work (as it doesn't die) but it > still appends to the end of the file, no

RE: writing to a text file on win 2000

2001-05-29 Thread Tim Dumas
Title: RE: writing to a text file on win 2000 Do you have a fully qualified pathname including the prepending '//SERVER' Where SERVER is your servername. Hope this helps, Tim Dumas [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[E

Re: interfacing with Eudora

2001-05-29 Thread Andy Jennings
Mike You don't even really need Eudora for this. It's pretty simple to have your list of addresses in one text file, your message body in another and then a script sucks them in and fires out mails to the mail server you specify. Because a mail sending transaction is fairly linear and straightfo

Re: directory

2001-05-29 Thread Glenn Linderman
If you get it from STDIN, you probably need to chomp it to get rid of the trailing newline stuff. as in print "prompt>"; chomp ( $dirname = ); And, per another message, you cannot append to the front of a file, there is already data at the front of the file, and if you were able to write ther

RE: directory

2001-05-29 Thread Tanya Graham
i don't think it is finding the files in the directory...when i hardcoded a PRINT to one of the files in the directory it appended it. here's another little problem...the Seek function SEEMS to work (as it doesn't die) but it still appends to the end of the file, not the beginning. (when i take o

RE: directory

2001-05-29 Thread Tanya Graham
ok, i don't get the "." or ".." error anymore...thanks! however, it doesn't append anything. i don't get any errors and it never dies, it just doesn't do anything. any ideas why? here is my code: #!/usr/bin/perl $dirname = 'C:/PerlExp'; opendir (DIR, $dirname) or die "can't open d

Re: directory

2001-05-29 Thread Ron
Tanya, next if($file =~ /^.+$/);# from Tushar and... next if $file eq '.' or file eq '..'; # from me ... do the same thing. Unless you have a file called '...' or '...' :) Ron - Original Message - From: "Kulkarni, Tushar (GEL, MSX)" <[EMAIL PROTECTED]> To: "'Tan

RE: directory

2001-05-29 Thread Wantock, Ron L.
The file names that you are retrieving with the readdir command do not have the full path on them. To open them you need to append the path onto the front. open (SOURCE, ">>$dirname/$file"); wantor > -Original Message- > From: Tanya Graham [mailto:[EMAIL PROTECTED]] > Sent: Tuesday,

Re: directory

2001-05-29 Thread Ron
'.' is the current directory and '..' is the parent of '.' The are in your list from readdir just as they are if you type 'dir' in a DOS window. Try this: (I added line tested elsewhere: next if $file eq '.' or file eq '..';) #!/usr/bin/perl $dirname = 'C:/PerlExp'; opendir (DIR, $dirname) or

RE: directory

2001-05-29 Thread Kulkarni, Tushar (GEL, MSX)
Just put, next if($file =~ /^.+$/); at the start of your while loop. "." and ".." directories are special directories which refers to current directory and parent directory. U need to skip this. Hope this solves ur problem Tushar -Original Message- From: Tanya Gra

Re: directory

2001-05-29 Thread Ron
You can use / inside single or double quotes. You can use \ inside single quotes. You can use \\ inside double quotes. You can't use \ inside single quotes. (Not for a dir separator, anyway: Perl assumes you are starting an escape sequence) - Original Message - From: <[EMAIL PROTECTED]

RE: directory

2001-05-29 Thread Tanya Graham
ok, for some reason if i hardcode it, it is fine. it won't work if i try and get it from STDIN. anyway, here is my program: #!/usr/bin/perl $dirname = 'C:/PerlExp'; opendir (DIR, $dirname) or die "can't open directory $dirname: $!"; while ( defined ($file = readdir (DIR)

Re: directory

2001-05-29 Thread Ron
>From perlport document: = "System calls accept either / or \ as the path separator. However, many command?line utilities of DOS vintage treat / as the option prefix, so they may get confused by filenames containing /. Aside from calling any ex

RE: directory

2001-05-29 Thread Chuck . Hirstius
>it still doesn't work...it says there is no such file or directory...why >does it use back slashes, but when i specify the path i'm supposed to use >forward slashes? >tanya See Response below... >>Hi, >>I am trying to open a directory, but I don't know how to specify it >>exactly. >>I just ne

Re: directory

2001-05-29 Thread Ron
use strict; # change this to a dir on your system my $some_dir = 'C:\My Documents\My Pictures\PowerPics'; # create dir handle DIR first opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!"; # array of file names from DIR my @files = readdir(DIR); # do something with your data print joi

RE: directory

2001-05-29 Thread Tanya Graham
it still doesn't work...it says there is no such file or directory...why does it use back slashes, but when i specify the path i'm supposed to use forward slashes? tanya -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 29, 2001 3:35 PM To: [EMAIL PR

Re: directory

2001-05-29 Thread Chuck . Hirstius
>Hi, >I am trying to open a directory, but I don't know how to specify it exactly. >I just need to open something in the C drive, under a folder named PerlExp. >I know this is a dumb question, but does anyone want to help me? >thanks >tanya graham Tanya, You can open directories in a mannor ver

directory

2001-05-29 Thread Tanya Graham
Hi, I am trying to open a directory, but I don't know how to specify it exactly. I just need to open something in the C drive, under a folder named PerlExp. I know this is a dumb question, but does anyone want to help me? thanks tanya graham -Original Message- From: Purcell, Scott [mailto

Re: remove duplicate lines

2001-05-29 Thread Glenn Linderman
And if you need to retain the "first seen" order in the output file, you could do something like print $_ unless $texthash{$_}; just before Scott's chomp below (which may or may not be needed). "Purcell, Scott" wrote: > I am not an expert here, but why compare each line. Read each line in

RE: remove duplicate lines

2001-05-29 Thread Purcell, Scott
I am not an expert here, but why compare each line. Read each line into a hash, whereas each line becomes a key, and set the value to something like a 1, and your dups would be gone, quickly and I believe pretty efficiently. eg. my %textHash = (); open (SOMEDATAFILE, "<$pathToFile/theFile") or di

remove duplicate lines

2001-05-29 Thread Dan Jablonsky
Hi all, I need to remove duplicate lines from a whole bunch of files, I already have a script that does this but it's brute force (compare first line with the others one by one; if no match write it to another file), hence very inefficient. Somehow I believe there must be a nicer approach. Does an