RE: [New Question] Large file line by line

2003-08-14 Thread Tim Johnson
The difference is that Perl reads the entire file into memory when you do a "@file = ", but it only reads one line at a time if you do a "while()". The difference definitely becomes clear if you try to do that with a 180MB file on a machine with 128MB RAM. -Original Message- From: Pablo

RE: Archive::Zip funnny return status

2003-08-06 Thread Tim Johnson
If you do a "perldoc Archive::Zip" (I would print out a hard copy of the result, it's pretty long), you should get all of the error codes, methods, etc. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 9:44 AM To: Dan Muey Cc: [EMAIL P

RE: Archive::Zip funnny return status

2003-08-05 Thread Tim Johnson
I think your pattern match will only catch a literal AZ_OK, not the constant. And I'm not sure, but AZ_OK might evaluate to 0. At least I think I remember having trouble with that module because it returns 0 on success, and I kept testing for TRUE/FALSE based on the return status. -Original

RE: How to check if the job is failure or successful in sub1 befo re calling sub2

2003-07-25 Thread Tim Johnson
Usually you do this by returning a 0 if the sub fails or any other value if it is successful. Simple Example: if(lookforfolder()){ print "It's there!\n"; }else{ print "Folder not found\n"; } sub lookforfolder{ if(-d "/home/me"){ return 1; }else{ return 0; } -O

RE: IDE for Perl Development

2003-07-25 Thread Tim Johnson
That depends on what you mean by IDE. If you just want your basic syntax highlighting, etc, then vim is a pretty good one, and I know it's available on Linux and Win32. -Original Message- From: Trevor Morrison [mailto:[EMAIL PROTECTED] Sent: Thursday, July 24, 2003 7:54 PM To: [EMAIL PR

RE: How to extract users from a group in windows 2000 Active Dire ctory?

2003-07-15 Thread Tim Johnson
I can't answer this question outright, since I haven't had the pleasure of working with AD as of yet, but here are a couple of resources to check. There's a [EMAIL PROTECTED] mailing list specifically for W2k/NT questions involving Perl. Also, get thee to a bookstore and buy Dave Roth's Win32 Per

RE: How to run a shell command but not waiting for the result ?

2003-07-14 Thread Tim Johnson
This will only work on Win32 systems, and it's kind of cheating, but... system("start notepad"); The start command in Windows executes the command more or less as if it was typed in at the Run... dialog. Start will exit immediately after launching the program. -Original Message- From:

RE: Perl on Visual studio

2003-07-13 Thread Tim Johnson
There is a Perl.NET package that ActiveState distributes. They call it Visual Perl, and I've heard it works quite well, but it's a little pricy. -Original Message- From: Janek Schleicher To: [EMAIL PROTECTED] Sent: 7/13/03 5:16 AM Subject: Re: Perl on Visual studio Ronen Kfir wrote at

RE: Search and Replace

2003-07-13 Thread Tim Johnson
There's one caveat to be aware of with doing a "@array = " type of file read. If you end up having to work with very large files (or you don't have a whole lot of RAM to work with), you could be slowing down your program, maybe drastically if you try to load the entire file into memory at once,

RE: Search and Replace

2003-07-12 Thread Tim Johnson
In general, what you want to do is this; 1. open the file for reading 2. open a second file for writing 3. read in each line, doing the substitution (although technically using the tr/// operator might be quicker) 4. after each substitution, print the result to the second file 5. once al

RE: Perl and Exchange Server

2003-07-11 Thread Tim Johnson
Maybe it would help if you gave us what you've tried? -Original Message- From: Chris Rogers [mailto:[EMAIL PROTECTED] Sent: Friday, July 11, 2003 8:24 AM To: [EMAIL PROTECTED] Org (E-mail) Subject: Perl and Exchange Server I have been trying for some time to get at the contacts in a mai

RE: silly question

2003-07-09 Thread Tim Johnson
Short answer: A socket is a machine address and a TCP port, identifying a particular application running at a particular address. This allows two-way communication between machines running a particular application. Long answer: http://www.faqs.org/rfcs/rfc147.html -Original Message-

RE: readdir unlink any symlinks

2003-07-07 Thread Tim Johnson
(BIt doesn't look like you are setting the $_ variable anywhere. Maybe if you (Bput this line in after the opendir and before the first bracket: (B (Bforeach(readdir(DIR)) (B (Band closed the bracket (B (B-Original Message- (BFrom: Harry Putnam [mailto:[EMAIL PROTECTED] (BSent:

RE: Warn if ?

2003-07-07 Thread Tim Johnson
$x will evaluate to false if it is 0 or evaluates to 0, if it is an empty string, or if it is undef. So for the most part if $x has anything in it, it will evaluate to true. The code below says, "If $x has anything in it, then call warn with $x as a parameter". Personally, I usually go out

RE: Disk space on windows 2000

2003-07-07 Thread Tim Johnson
Maybe I missed part of the thread, but why not just use PPM? C:\> PPM PPM> set repository DAVE http://www.roth.net/perl/packages PPM> set save PPM> install Win32-AdminMisc If you are using ActiveState's ActivePerl, then this should work for you. -Original Message- From: Kipp, James [mai

RE: perl script for a timer on ms-dos

2003-07-01 Thread Tim Johnson
Check out the sleep() function. You can make your script sleep for the specified number of seconds. -Original Message- From: shubha kenkre [mailto:[EMAIL PROTECTED] Sent: Monday, June 30, 2003 10:40 AM To: [EMAIL PROTECTED] Subject: perl script for a timer on ms-dos Hi!, I am trying t

RE: PERL HANG on WINDOWS AND WAITING FOR TO PRESS ENTER

2003-06-30 Thread Tim Johnson
ginal Message- From: Madhu Reddy [mailto:[EMAIL PROTECTED] Sent: Monday, June 30, 2003 9:24 AM To: Tim Johnson; [EMAIL PROTECTED] Subject: RE: PERL HANG on WINDOWS AND WAITING FOR TO PRESS ENTER Hi, I am already re-directing erros messages to file... and i am sure that there were no erros. ev

RE: Strange behaviour of chdir in mapped drives

2003-06-30 Thread Tim Johnson
drive mapping, I would recommend mapping it within your script if you have the same problems. -Original Message- From: Smith Jeff D [mailto:[EMAIL PROTECTED] Sent: Monday, June 30, 2003 7:47 AM To: 'Tim Johnson'; 'Akens, Anthony'; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subje

RE: PERL HANG on WINDOWS AND WAITING FOR TO PRESS ENTER

2003-06-30 Thread Tim Johnson
The problem is probably in your system() command. I would recommend redirecting STDERR to a file to see what messages you are getting. Try putting: open(STDERR,">error.log") || die "$!\n"; at the beginning of the section with the system commands. If you are not on a Win32 system, then I th

RE: Strange behaviour of chdir in mapped drives

2003-06-30 Thread Tim Johnson
That's exactly right. You will run into the same problem if you try running your scripts in the scheduler. -Original Message- From: Akens, Anthony [mailto:[EMAIL PROTECTED] Sent: Monday, June 30, 2003 7:12 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Strange behaviour of chdi

RE: HELP! Reg-ex question

2003-06-27 Thread Tim Johnson
I can't test this out here, but I think the e after the regex makes the right side get evaluated as code, so maybe you need to put quotes around the right-hand side of your regex: $text=~s/$pattern/"$replacement"/e; -Original Message- From: Mike To: [EMAIL PROTECTED] Sent: 6/26/03 12:

RE: How to use command-line switches...

2003-06-26 Thread Tim Johnson
This will work for the most part, but I would really recommend against it. Check out the docs for Getopt::Std. It is much simpler than Getopt::Long, and will really end up simplifying your scripts, although it might not seem like it at first look. Here's an example of a script that uses Getopt:

RE: Regex problem

2003-06-25 Thread Tim Johnson
Try this: my $string = 'I love c++'; my $compare = 'some compare string'; if ($compare =~ /\Q$string/) { #disables metacharacters until \E print "$compare contains $string\n"; } else { print "$compare does not contain $string\n"; } -Original Message- From: Beau E. Cox [mailto:[EM

RE: Accessing MSSQL database

2003-06-25 Thread Tim Johnson
There is also a dbi-users mailing list that can be very helpful for DBI related questions. -Original Message- From: Dan Muey [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 6:08 AM To: Sparrow, Dave; [EMAIL PROTECTED] Subject: RE: Accessing MSSQL database > OK, please keep it

RE: Simple doublt of $_ and print;

2003-06-24 Thread Tim Johnson
That's because when you read from the file handle using the <> brackets, it doesn't automatically put the line into $_. You're just throwing away the result. print() does print $_, but in this case there's nothing in it. BTW, my personal advice would be to avoid the implied $_ magick until you a

RE: Exchange Server Mailbox format

2003-06-22 Thread Tim Johnson
I don't think Microsoft will ever give out the exact format that their database is in for parsing, for obvious reasons. If you want to parse the contents of mailboxes, I would recommend checking out the Win32::Exchange module and a good long research session at www.microsoft.com/msdn. You can us

RE: html smtp

2003-06-18 Thread Tim Johnson
Very generally, you will need to send the line Content-Type: text/html in your header before the data section. Then you can use regular html tags to format your text. -Original Message- From: anthony To: [EMAIL PROTECTED] Sent: 6/18/03 12:26 AM Subject: html smtp Hi, I would like t

RE: Access DB

2003-06-17 Thread Tim Johnson
Here's how I used to connect using DBI and DBD::ODBC. I would pass the access database's name as a parameter. From here you can just use dbi and SQL to manipulate the DB. If you need more help with DBI I would recommend posting in the dbi-users group. my $dbh = DBI->connect("dbi:ODBC:driver=Mi

RE: Is empty directory?

2003-06-16 Thread Tim Johnson
I think you can also do it this way if it makes more sense (someone correct me if I'm wrong, I can't test this here): my $count = (readdir $dh); Which (again, correct me if I'm wrong) basically says "Assign the scalar value of the list whose elements are created by executing "readdir $dh" to the

RE: concatonate to file?

2003-06-16 Thread Tim Johnson
In Perl there is a concatenation operator for this kind of thing, the dot (.) Once you've formatted your date, you should be able to do something like this: my $newfile = $file.$date; rename $file,$newfile; I think that's what you're asking... -Original Message- From: West, William M [

RE: Maybe OFF Topic - FTP Directory Size

2003-06-16 Thread Tim Johnson
You can do this with Net::FTP, but you'll have to write your own recursive subroutine to get the subfolders... -Original Message- From: Paul Kraus [mailto:[EMAIL PROTECTED] Sent: Monday, June 16, 2003 8:09 AM To: [EMAIL PROTECTED] Subject: Maybe OFF Topic - FTP Directory Size Is their

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

RE: Last Logon of ALL users in the domain

2003-06-12 Thread Tim Johnson
stLogon.pl -- Gets a list of Domain Users # # and outputs the result to a .csv file # # by Tim Johnson with thanks to [EMAIL PROTECTED] # # version

RE: File::Copy -> Additional Parameters?

2003-06-11 Thread Tim Johnson
You could always use stat() on the files to decide which ones you want to copy... -Original Message- From: Ben Crane [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 11, 2003 4:31 AM To: [EMAIL PROTECTED] Subject: File::Copy -> Additional Parameters? Hi all, Anyone know if the perl modu

RE: substituting char in other languages besides english

2003-05-30 Thread Tim Johnson
Here's a few... ÁÉÍÓÚáéíóúÀÈÌÒÙàèìòùÑñ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, May 29, 2003 12:50 PM To: [EMAIL PROTECTED] Subject: substituting char in other languages besides english In my program I have a place where people can put descr

RE: Comparing Dates Conditional statements

2003-05-27 Thread Tim Johnson
That won't work if the dates are more than a year apart(i.e. 100302 will appear to be greater than 011503). I would recommend looking into the Time::Local module. You can use it to convert the text dates into Perl time() format. Then you can easily do a numeric conversion. -Original Messag

<    1   2   3