RE: misunderstanding the /g modifier on REGEX

2003-06-12 Thread Tim Johnson
David, if you don't mind, could you give an explanation of what you're doing here? I'm not sure if everyone is familiar with the method you're using to look ahead. -Original Message- From: david [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 5:28 PM To: [EMAIL PROTECTED] Subject

RE: misunderstanding the /g modifier on REGEX

2003-06-12 Thread Tim Johnson
I'm not really giving you the answer you're looking for, but here is one way to go about it: while(<>){ my @temp = split(/\|/,$_); foreach my $item(@temp){ if($item eq ''){ $item .= ' '; } } print join('|',@temp); } -Original Message- From: M z [mailto:[EMAIL PROTE

[very long] Re: $?

2003-06-12 Thread Steve Grazzini
On Thu, Jun 12, 2003 at 09:07:48PM +0100, Nick Drage wrote: > I was given this answer by David van der Geer, who used: > > $exit_value = $? >> 8; > > I'm not sure what " >> 8 " means though, anyone? Short answer: It's the right-shift operator. It takes an integer and shifts all the bits to the

Re: misunderstanding the /g modifier on REGEX

2003-06-12 Thread david
M Z wrote: > hello all - > > I am trying to do the following to this data: > input: > X|YZ||A > > desired output: > X|Y| | | |Z| |A > > simply replacing || with | | > whereever it may occur in the string. > > This bit of code doesn't seem to do all of the job. > > What is wrong with this

RE: Last Logon of ALL users in the domain

2003-06-12 Thread Tim Dumas
If you want the Time of logon along with the date you can use this modified version. use Win32::OLE; use Win32::OLE::Variant; use Win32::OLE::NLS qw(:LOCALE :DATE); my $domain = Win32::OLE->GetObject("WinNT://DomainHere"); foreach my $object (in $domain) { if ($object->{Class} eq 'User')

Re: $?

2003-06-12 Thread Nick Drage
On Thu, Jun 12, 2003 at 08:05:48PM +0200, Olivier Wirz wrote: > Hello, > > I would like to know if there is a way to check $? to see whether the > programm ran correctly in such a statement: > > @results =`grep $search $_`; $exitcode=$?; And there you have it, $exitcode is your exit code. I wa

RE: Last Logon of ALL users in the domain

2003-06-12 Thread Gould, Kevin
I've written one that gets a list of all DC's, forks a process for each one, and then watches for completion of all processes. It then combs the reports generated by each, selects the most recent date for each user, and cleans up the working files. It still takes a long time as I'm doing the quer

misunderstanding the /g modifier on REGEX

2003-06-12 Thread M z
hello all - I am trying to do the following to this data: input: X|YZ||A desired output: X|Y| | | |Z| |A simply replacing || with | | whereever it may occur in the string. This bit of code doesn't seem to do all of the job. What is wrong with this code? while (<>) { while($_ =~ /([|])([|

misunderstanding the /g modifier on REGEX

2003-06-12 Thread M z
hello all - I am trying to do the following to this data: input: X|YZ||A desired output: X|Y| | | |Z| |A simply replacing || with | | whereever it may occur in the string. This bit of code doesn't seem to do all of the job. What is wrong with this code? while (<>) { while($_ =~ /([|])([|

RE: Last Logon of ALL users in the domain

2003-06-12 Thread Leon
This totally 100 percent worked. Thank you so much "Tillman, James" <[EMAIL PROTECTED]> wrote: This works on my own domain from a Win2k or NT box: use Win32::OLE; use Win32::OLE::Variant; use Win32::OLE::NLS qw(:LOCALE :DATE); my $domain = Win32::OLE->GetObject("WinNT://IRM-NT"); foreach m

Last Logon of ALL users in the domain

2003-06-12 Thread Leon
Hi guys (and ladies!), I am trying to write a script to find out the last logon of all users in a domain. I see that with adminmisc I can query a users last logon but this has to be done on every domain controller. That's fine cause I know that I can use netadmin and lanman to get a list of

Re: Last Logon of ALL users in the domain

2003-06-12 Thread Leon
Hi Robert, Unfortunately after examining this script it works via passing a username to it. I can do this with adminmisc. I need to check ALL users in the domain. Here is a snippet of the code and what it appears to do: $username = $ARGV[0]; Grab the username from ARGV I appreciate the

Re: XML::LibXSLT problem

2003-06-12 Thread Rob Dixon
Ryan wrote: > Can't coerce GLOB to string in entersub at > /usr/local/lib/perl5/site_perl/5.6.1/i686-linux/XML/LibXSLT.pm line 88. > XML::LibXSLT::parse_stylesheet('XML::LibXSLT=HASH(0x8cc31e0)', > 'XML::LibXML::Document=SCALAR(0x8c5d6f4)') called at > /home/seeker/Omnibase/lib/Omnibase/UI/Web.pm l

RE: Last Logon of ALL users in the domain

2003-06-12 Thread Tim Johnson
Here is an old script I wrote for doing just that. It's not the cleanest code, but I haven't bothered to change it because it works. # # #GetUsers_LastLogon.pl --

RE: Perl -w odd error

2003-06-12 Thread Miller, Joseph S
You need to do a loop of some sort and extract the data from the file try: open (CNTFILE, "${OUTPUTFILE}") or die "Can't open ${OUTPUTFILE} : $!"; for ($i= 0; ; $i++){ $file_date = $_; $FILE[$i]= $file_data; } close(CNTFILE); -Original Message- From: Yacketta, Ronald [mai

RE: Perl -w odd error

2003-06-12 Thread Charles K. Clarkson
Yacketta, Ronald <[EMAIL PROTECTED]> wrote: : I have the following block of code: : : open (CNTFILE, "${OUTPUTFILE}") or die "Can't open : ${OUTPUTFILE} : : $!"; : @FILE=; : close(CNTFILE); : : Which reports this warning: : : Name "main::CNTFILE" used only once: possib

Perl -w odd error

2003-06-12 Thread Yacketta, Ronald
Folks, I have the following block of code: open (CNTFILE, "${OUTPUTFILE}") or die "Can't open ${OUTPUTFILE} : $!"; @FILE=; close(CNTFILE); Which reports this warning: Name "main::CNTFILE" used only once: possible typo at ./OrderTakingTree.pl line 151. I am just opening

XML::LibXSLT glob problem

2003-06-12 Thread ryan
Please help a desperate sole This is the error that I am receiving Can't coerce GLOB to string in entersub at /usr/local/lib/perl5/site_perl/5.6.1/i686-linux/XML/LibXSLT.pm line 88. XML::LibXSLT::parse_stylesheet('XML::LibXSLT=HASH(0x8cc31e0)', 'XML::LibXML::Document=SCALAR(0x8c5d6f4)') calle

Re: $?

2003-06-12 Thread Sudarshan Raghavan
Olivier Wirz wrote: Hello, I would like to know if there is a way to check $? to see whether the programm ran correctly in such a statement: @results =`grep $search $_`; Yes using the $? variable. ($? >> 8) will give you the exit status. perldoc perlvar perldoc -f system Thank you Olivi

RE: Regex Consult

2003-06-12 Thread Peter Fleck
Peter Fleck [mailto:[EMAIL PROTECTED] : : ( : $date=~/^((\d\d?)\/(\d\d?)\/(((\d{2,2}))|(\d{4,4})))($|(,(\s*) : ((\d\d?)\/(\d\d?)\/(((\d{2,2}))|(\d{4,4}+$)/ : ) What about split: my @dates = split m#/|,\s*#, 'mm/dd/yy, mm/dd/yy'; printf "Dates retrieved: %s\n", @dates / 3; Bit late in res

RE: XML::LibXSLT problem

2003-06-12 Thread Ryan
Can't coerce GLOB to string in entersub at /usr/local/lib/perl5/site_perl/5.6.1/i686-linux/XML/LibXSLT.pm line 88. XML::LibXSLT::parse_stylesheet('XML::LibXSLT=HASH(0x8cc31e0)', 'XML::LibXML::Document=SCALAR(0x8c5d6f4)') called at /home/seeker/Omnibase/lib/Omnibase/UI/Web.pm line 93 Line 88

Re: XML::LibXSLT problem

2003-06-12 Thread Rob Dixon
Ryan wrote: > This is where I am now > > > > If anyone could help on this it would be great. > > > > Can't coerce GLOB to string in entersub at > /usr/local/lib/perl5/site_perl/5.8.0/i686-linux/XML/LibXSLT.pm line 108. > > > > sub parse_stylesheet { > > my $self = shift; > > if (!ref($self)

XML::LibXSLT problem

2003-06-12 Thread ryan
This is where I am now If anyone could help on this it would be great. Can't coerce GLOB to string in entersub at /usr/local/lib/perl5/site_perl/5.8.0/i686-linux/XML/LibXSLT.pm line 108. sub parse_stylesheet { my $self = shift; if (!ref($self) || !$self->{XML_LIBXSLT_MATCH})

RE: Last Logon of ALL users in the domain

2003-06-12 Thread Rosenstein, Leon
Is there way to have it query all domain controllers in the domain? I was thinking of modifying it to run the script as a subroutine and use lanman or netadmin to loop it through all the DC's. The problem is if you have more then one DC you wont get accurate results. It needs to be run on each o

$?

2003-06-12 Thread Olivier Wirz
Hello, I would like to know if there is a way to check $? to see whether the programm ran correctly in such a statement: @results =`grep $search $_`; Thank you Olivier _ MSN Search, le moteur de recherche qui pense comme vous !

RE: Last Logon of ALL users in the domain

2003-06-12 Thread Tillman, James
This works on my own domain from a Win2k or NT box: use Win32::OLE; use Win32::OLE::Variant; use Win32::OLE::NLS qw(:LOCALE :DATE); my $domain = Win32::OLE->GetObject("WinNT://IRM-NT"); foreach my $object (in $domain) { if ($object->{Class} eq 'User') { my $last_login; if ($object->{LastLogi

RE: Last Logon of ALL users in the domain

2003-06-12 Thread Tillman, James
Oh, by the way... you'll want to replace the IRM-NT in the script with your own domain, of course. Sorry about that. jpt -Original Message- From: Leon [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 12:35 PM To: Robert-Jan Mora Cc: perl; win32; Yahoo Beginner Perl Subject: Re: L

Re: Perl-Tk Menuframe (maybe OT)

2003-06-12 Thread zentara
On Thu, 12 Jun 2003 08:44:42 +0200, [EMAIL PROTECTED] (Jaschar Otto) wrote: >hi, >i know there is a perl tk mailinglist but i don't want to >do all this subscribe stuff atm so i ask here since you >all helped me a lot already (thanks a lot again) :-) No need for subscribing to a maillist. There is

Re: Problem with XML::LibXSLT

2003-06-12 Thread Rob Dixon
Ryan wrote: > Does any one know what this is referring to or how to fix it? > > Can't coerce GLOB to string in entersub at > /usr/local/lib/perl5/site_perl/5.6.1/i686-linux/XML/LibXSLT.pm line 88. > XML::LibXSLT::parse_stylesheet('XML::LibXSLT=HASH(0x8cc31e0)', > 'XML::LibXML::Document=SCALAR(0x8c5

RE: File not getting written

2003-06-12 Thread Ryan
Does any one know what this is referring to or how to fix it? Can't coerce GLOB to string in entersub at /usr/local/lib/perl5/site_perl/5.6.1/i686-linux/XML/LibXSLT.pm line 88. XML::LibXSLT::parse_stylesheet('XML::LibXSLT=HASH(0x8cc31e0)', 'XML::LibXML::Document=SCALAR(0x8c5d6f4)') Thanks, Ryan

Re: File::Copy -> Additional Parameters? Thank you

2003-06-12 Thread Ben Crane
Okay, Some good leads to work with...Thanx for the heads up guys!! Ben __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:

Re: File not getting written

2003-06-12 Thread Mark G
- Original Message - From: "Jenda Krynicky" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, June 12, 2003 9:17 AM Subject: RE: File not getting written > From: Rob Das <[EMAIL PROTECTED]> > > I'm trying to merge a whole bunch of files (possibly tens of > > thousands) into one

Re: Wanted: Help with modules/packages

2003-06-12 Thread Sudarshan Raghavan
Richard Heintze wrote: I apologize if I'm posting this twice. I assume that it did not go out to the group because I did not get any responses and the folks at [EMAIL PROTECTED] have been extremely helpful in the past. Can somone help me make my sample program work below? (1) I cannot call funct

Re: printing a hash

2003-06-12 Thread James Edward Gray II
On Wednesday, June 11, 2003, at 10:33 PM, Stuart White wrote: Well, I got the out put that I wanted. the use Data::Dumper; call really helped with my debugging, thanks for the tip. I understand what's going on except for the printing and the foreach loops, can someone break that down for me?

Re: slowing down output and multi-line comments

2003-06-12 Thread Jenda Krynicky
From: Stuart White <[EMAIL PROTECTED]> > Outside of putting in calls to ; is there a way > to slow down the output of a perl program? If I have > a lot of output to be printed, I never get to see the > beginning of it, only the end. Alternatively, if I > could make the little black screen a full

Re: Wanted: Help with modules/packages

2003-06-12 Thread Jenda Krynicky
From: Richard Heintze <[EMAIL PROTECTED]> > Can somone help me make my sample program work below? > (1) I cannot call function hello from main.pl. Why? Because you've loaded a different Test.pm than you wanted. Rename the module to TestX and see. > (2) In main, is it necessary to say $test::x? I

RE: slowing down output and multi-line comments

2003-06-12 Thread Bob Showalter
Stuart White wrote: > Outside of putting in calls to ; is there a way > to slow down the output of a perl program? If I have > a lot of output to be printed, I never get to see the > beginning of it, only the end. Alternatively, if I > could make the little black screen a full screen, AND > keep

RE: Returning the first key in a hash...

2003-06-12 Thread Charles K. Clarkson
Hamish Whittal <[EMAIL PROTECTED]> wrote: : : I have a hash that looks like: : : { number => {somethings in here} } : : Now I need to get at number, not what it references. my %hash = ( number => {} ); foreach my $key ( keys %hash ) { # do something with each key ($key) } Since your h

Wanted: Help with modules/packages

2003-06-12 Thread Richard Heintze
I apologize if I'm posting this twice. I assume that it did not go out to the group because I did not get any responses and the folks at [EMAIL PROTECTED] have been extremely helpful in the past. Can somone help me make my sample program work below? (1) I cannot call function hello from main.pl. W

Re: slowing down output and multi-line comments

2003-06-12 Thread James Edward Gray II
On Thursday, June 12, 2003, at 08:40 AM, Stuart White wrote: Outside of putting in calls to ; is there a way to slow down the output of a perl program? If I have a lot of output to be printed, I never get to see the beginning of it, only the end. sleep() can be given a number of seconds to pause

Re: Returning the first key in a hash...

2003-06-12 Thread James Edward Gray II
On Thursday, June 12, 2003, at 07:30 AM, Hamish Whittal wrote: I have a hash that looks like: { number => {somethings in here} } Now I need to get at number, not what it references. If I understand correctly, you're trying to get the lowest number hash key. That we can do. Try: my $lowest =

RE: Searching for a Perl Project to work on

2003-06-12 Thread Nigel Peck - MIS Web Design
Have you had a look on: http://www.sourceforge.net/ Plenty of projects on there. Cheers, Nigel MIS Web Design http://www.miswebdesign.com/ > -Original Message- > From: rajeev [mailto:[EMAIL PROTECTED] > Sent: 12 June 2003 14:38 > To: [EMAIL PROTECTED] > Subject: Searching for a Perl Pro

slowing down output and multi-line comments

2003-06-12 Thread Stuart White
Outside of putting in calls to ; is there a way to slow down the output of a perl program? If I have a lot of output to be printed, I never get to see the beginning of it, only the end. Alternatively, if I could make the little black screen a full screen, AND keep the font size the same so I'd ac

Searching for a Perl Project to work on

2003-06-12 Thread rajeev
Hi all, I joined the list only today. I'm searching for some good Perl Projects to work on. Its not that i have not searched the web for it, but i did not find a suitable one. My current skill in Perl is "intermediate", but i do not know CGI programming, but willing to learn. I have already desi

RE: File not getting written

2003-06-12 Thread Jenda Krynicky
From: Rob Das <[EMAIL PROTECTED]> > I'm trying to merge a whole bunch of files (possibly tens of > thousands) into one file. Here's my code (with the error checking > removed for readability): > > opendir(INDIR, $indir); > @logfile=grep(/$mask/i, readdir INDIR); > closedir(INDIR); > [EMAIL PROTECT

Re: Returning the first key in a hash...

2003-06-12 Thread Sudarshan Raghavan
Rob Dixon wrote: Hamish Whittal wrote: Ok, thanks Sudarshan, but why did this not work? pop ( keys (%hash) ); 'pop' operates on an array, not a list. This would work my @keys = keys %hash; my $key = pop @keys; I guess you meant shift (@keys), pop will return the last key returned by

Re: Returning the first key in a hash...

2003-06-12 Thread Sudarshan Raghavan
Hamish Whittal wrote: Ok, thanks Sudarshan, but why did this not work? pop ( keys (%hash) ); perldoc -f pop pop works on arrays, keys returns a list (perldoc -f keys) perldoc -q 'What is the difference between a list and an array?' Anyways, pop returns the last element of the array not the fir

Re: Returning the first key in a hash...

2003-06-12 Thread Rob Dixon
Hamish Whittal wrote: > Ok, thanks Sudarshan, but why did this not work? > > pop ( keys (%hash) ); 'pop' operates on an array, not a list. This would work my @keys = keys %hash; my $key = pop @keys; HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail

RE: Comparing timestamp of 2 files

2003-06-12 Thread Bob Showalter
Amit Sharma wrote: > But -M option gives -M Script start time minus file modification > time, in days. > But I need the difference in seconds between 2 different files and > not with the script. Well, you should have said that. -M is easiest way to compare two files to see if one is older or newe

RE: Returning the first key in a hash...

2003-06-12 Thread Hamish Whittal
I have a hash that looks like: { number => {somethings in here} } Now I need to get at number, not what it references. Tx. H On Thu, 2003-06-12 at 14:22, Charles K. Clarkson wrote: > Hamish Whittal <[EMAIL PROTECTED]> wrote: > : > : I have a hash and want to return the first key in > : the hash

Re: Returning the first key in a hash...

2003-06-12 Thread Hamish Whittal
Ok, thanks Sudarshan, but why did this not work? pop ( keys (%hash) ); Thanks. H On Thu, 2003-06-12 at 14:39, Sudarshan Raghavan wrote: > Hamish Whittal wrote: > > >Hi all, > > > >I have a hash and want to return the first key in the hash. How can I do > >this? > > > > The answer is (keys (%yo

RE: Returning the first key in a hash...

2003-06-12 Thread Charles K. Clarkson
Hamish Whittal <[EMAIL PROTECTED]> wrote: : : I have a hash and want to return the first key in : the hash. How can I do this? You can't. The keys of a hash are unordered. there is no first key (or second key, or lastkey, etc.) To get a "first key", you'll have to define what a "first key" is

RE: Returning the first key in a hash...

2003-06-12 Thread Rai,Dharmender
#! /usr/bin/perl -w use strict; my %hash = ('a1', '2', '3', '4'); my @arr = %hash; print $arr[0]; Here you can get the actual sequence of keys in ur hash by printing all the even indexe elements of the array > -- > From: Sudarshan Raghavan[SMTP:[EMAIL PROTECTED] > Sent:

Re: Returning the first key in a hash...

2003-06-12 Thread Sudarshan Raghavan
Hamish Whittal wrote: Hi all, I have a hash and want to return the first key in the hash. How can I do this? The answer is (keys (%your_hash))[0]. This will return the first element in the list of hash keys returned by keys. But, you can never be sure of the order in which the keys will be re

Returning the first key in a hash...

2003-06-12 Thread Hamish Whittal
Hi all, I have a hash and want to return the first key in the hash. How can I do this? Thanks in advance, Hamish -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: File::Copy -> Additional Parameters?

2003-06-12 Thread Beau E. Cox
- Original Message - From: "Ben Crane" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 11, 2003 11:21 PM Subject: RE: File::Copy -> Additional Parameters? > Yep, I've thought of that, but with so many files > (it's an internal backup) I don't want to slow the > process

Re: File::Copy -> Additional Parameters?

2003-06-12 Thread Rob Dixon
Ben Crane wrote: > Yep, I've thought of that, but with so many files > (it's an internal backup) I don't want to slow the > process down by checking the source/dest filename on > both drives and their dates before copying, I was > hoping for there might be an obscure module out there > that handled

Re: Comparing timestamp of 2 files

2003-06-12 Thread Rob Dixon
Amit Sharma wrote: > Hi All, > > I need your help to compare the file timestamp of 2 different files. > Please suggest how can I do this in perl. Use 'stat' to fetch the create, modify, or inode change time of the files. Then compare them as numbers: my ($file1, $file2); my ($atime1, $mtime1

Re: File not getting written

2003-06-12 Thread Rob Dixon
Rob Das wrote: > Hi Rob: > > I'm trying to merge a whole bunch of files (possibly tens of thousands) into > one file. Here's my code (with the error checking removed for readability): > > opendir(INDIR, $indir); > @logfile=grep(/$mask/i, readdir INDIR); > closedir(INDIR); > [EMAIL PROTECTED]; # num

RE: File::Copy -> Additional Parameters?

2003-06-12 Thread Ben Crane
Yep, I've thought of that, but with so many files (it's an internal backup) I don't want to slow the process down by checking the source/dest filename on both drives and their dates before copying, I was hoping for there might be an obscure module out there that handled it neatly... If not, no wor

Re: Comparing timestamp of 2 files

2003-06-12 Thread Amit Sharma
But -M option gives -M Script start time minus file modification time, in days. But I need the difference in seconds between 2 different files and not with the script. Amit. >>> "Ohad Ohad" <[EMAIL PROTECTED]> 6/12/2003 1:19:52 PM >>> Check out http://www.perldoc.com/perl5.8.0/pod/func/-X.html

Re: Comparing timestamp of 2 files

2003-06-12 Thread Ohad Ohad
Check out http://www.perldoc.com/perl5.8.0/pod/func/-X.html You'll probably want to use the -M op. Ohad. From: "Amit Sharma" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: Comparing timestamp of 2 files Date: Thu, 12 Jun 2003 12:04:48 +0530 Hi All, I need your help to compare the file time