Which method is best for passing session id?
I'm trying to implement cgi sessions with Apache::Session and found myself contemplating on a method to pass session id to my script. I'll appreciate if someone experienced could help me out of that - by giving any pros and cons on the following methods: 1. URL 2. Hidden fields 3. Cookies Thanks guys Babs
Archive::TAR with better performance ?
Hi all, Is there a way to tar files without using the Archive::TAR module which is known to be very slow and ressource guzzler (comment in the faq). I am looking for a Perl module directly linked to the C library of tar to have almost the same performance and the power of perl ? Thanks in advance Michel -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Image::Magick Montage usage
Hi there, I have 189 gif images at 200x200 and I want to combine them in a 3x61 arrangement, ending up with a 600x12200 gif. Firstly is this just crazy talk? I realise this is a large image, but I've dealt with larger in the past. Secondly, what the hell am I doing wrong!? My code is below. I have the image filenames in a file. The first bit of the code grabs the filenames (all 8 characters long) and sticks them into @images. After this, it all gets a bit hazy. When I run the code, it gets as far as Montaging...\n but then hangs (12 hours and counting) whle the CPU usage goes through the roof. I used the code from here to create mine: http://savage.net.au/ImageMagick.html#ImageMagick_Hax_1_13 I would appreciate any pointers to where I'm going wrong, and also pointers to any documentation that might help me understand this better. Cheers, James ### #!/usr/bin/perl use warnings; use strict; use Image::Magick; my @images; my $input_file = '/home/james/montage_images/amalgam.txt'; my $output_file = 'home/james/montage_images/montage.gif'; my $image_dir = '/home/james/montage_images/'; my $result; open IN, $input_file or die Couldn't read $input_file: $!\n; while (IN) { chomp; if (/([A-Z0-9]{8}\.gif)/){ push (@images, $1); } } my($image) = Image::Magick - new(); my($stack) = Image::Magick - new(); my $counter = 1; for (1..63) { # I know I don't need these for now, for (1..3) { # I'm going to need them later. my $tile = pop @images; $result = $image - Read($image_dir.$tile); warn $result if $result; push (@$stack, $image); print $tile added to array ($counter)\n; $counter++; } } print Montaging...\n; my($final) = $stack - Montage ( tile= '3x63', geometry= '200x200' ); $result = $final - Write($output_file); warn $result if $result; print Success. Wrote $output_file. \n; The information contained in this e-mail is intended for the recipient or entity to whom it is addressed. It may contain confidential information that is exempt from disclosure by law and if you are not the intended recipient, you must not copy, distribute or take any act in reliance on it. If you have received this e-mail in error, please notify the sender immediately and delete from your system. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: urgent need for installing perl 5.8.0
Hi, I downloaded perl 5.8.0 from search.cpan.org While running make , I am getting this error : Can anyone throw some light about the cause: Making Errno (nonxs) make[1]: Entering directory `/perl-5.8.0/ext/Errno' Makefile out-of-date with respect to ../../lib/Config.pm ../../config.h Cleaning current config before rebuilding Makefile... make -f Makefile.old clean /dev/null 21 || /bin/sh -c true ../../miniperl -I../../lib -I../../lib Makefile.PL INSTALLDIRS=perl PERL_ CORE=1 LIBPERL_A=libperl.a Writing Makefile for Errno == Your Makefile has been rebuilt. == == Please rerun the make command. == false make[1]: *** [Makefile] Error 255 make[1]: Leaving directory `/perl-5.8.0/ext/Errno' make config failed, continuing anyway... make[1]: Entering directory `/perl-5.8.0/ext/Errno' ../../miniperl -I../../lib -I../../lib -I../../lib -I../../lib Errno_pm. PL Errno.pm sh: cc: not found No error definitions found at Errno_pm.PL line 180. make[1]: *** [Errno.pm] Error 1 make[1]: Leaving directory `/perl-5.8.0/ext/Errno' make: *** [ext/Errno/pm_to_blib] Error 2 Thanks -Original Message- From: Nilay Puri, Noida [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 10, 2004 1:15 PM To: Perl List (E-mail) Subject: urgent need for installing perl 5.8.0 Hi All, I want to install perl 5.8.0 on sun solaris. I am not getting the tar for perl 5.8.0 At the site ftp://ftp.cpan.org/pub/CPAN/src/5.0/ on trying to download perl-5.8.0.tar.gz I get error file not found. At other mirror sites I get the same error. I downlaoded stable.tar.gz , which again is perl 5.8.3. What to do to get perl 5.8.0 only. Quick reply will be appreciated. Thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Change file names
Hi all: Because '@' is a special character for many interpreters. I'm trying to change the names of 100 files deleting the '@' symbol. The filenames look like this: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] Thanks in advance. _:: A newbie ::_ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
DBI - an easier way??
Hi, bin using DBI for a while for data warehousing type stuff and up till now I've had to change data on the fly as it moves from one database to another : my $sql01 = qq{SELECT FIELD01 .FIELDn FROM PRODUCTION_TABLE}; my $sql02 = qq{INSERT INTO ACC_LEDG VALUES (?,?,?); my $sth = $dbh-prepare($sql01); $sth-execute; while (my @row = $sth-fetchrow) { $data1 = $row[0]; $data2 = $row[1]; .. and so on But now I just want to copy one table into an exact replica and to save on coding I want to avoid having to reference each DB column and the contents of it per row. Here's what I've got so far, the SELECT is working and I know pushing onto seperate arrays is wrong (gives HASH(0x820c324) etc. with print print @rows;) but I'm stuck on how to take it further. #!/usr/bin/perl use DBI;use DBD::Oracle; $dbh01 = DBI-connect(dbi:Oracle:PROD_DB, user, pwrd); $dbh02 = DBI-connect(dbi:Oracle:DATA__WAREHOUSE, usr, pwrd); my $sth01 = $dbh-prepare(SQL); SELECT * FROM TRANSACTIONS SQL $sth01-execute(); while( my $row = $sth01-fetchrow_hashref) { foreach my $col (keys %{$row} ) { print $col = $row-{$col}\n; push(@cols,$col); push(@rows,$row); } } my $fields = join(', ', @cols); my $values = join(', ', @rows); $sql02 = qq{INSERT INTO JDE.TRANSACTIONS2 ($cols) VALUES ($rows)}; $sth02 = $dbh02-prepare($sql02) or die Can't prepare SQL statement: $DBI::errstr\n; $sth02-execute();
Re: Archive::TAR with better performance ?
Hi all, Is there a way to tar files without using the Archive::TAR module which is known to be very slow and ressource guzzler (comment in the faq). I am looking for a Perl module directly linked to the C library of tar to have almost the same performance and the power of perl ? Thanks in advance Michel Well since you framed the question in this manner, aka you know about the module, I hope have tested it to see if it works for your stuff, and rejected it for a good reason, why not shell out? (I know, I know)... But Perl does have this capability and is probably better at it than other languages, just make sure you do the proper amount of work with it. Aka use full paths, taint checking, check return codes, etc. perldoc -f system There has to be a good reason why there isn't an XS tar, not that I know what it is http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Change file names
-Message d'origine- De: Tomas Corral [mailto:[EMAIL PROTECTED] Date: mercredi 10 mars 2004 13:07 À: [EMAIL PROTECTED] Objet: Change file names Hi all: Because '@' is a special character for many interpreters. I'm trying to change the names of 100 files deleting the '@' symbol. The filenames look like this: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] Thanks in advance. _:: A newbie ::_ Hi Tomas, Try this little and simple script : #!/usr/bin/perl -w use strict; open 'fh' ,'ls ./[EMAIL PROTECTED] |'; # create a file handle my @file_list = (fh); scalar (@file_list) or die There is no file to change; chomp(@file_list); foreach my $file (@file_list) { print renaming . $file; my $new_file = $file; $new_file =~ s/@/_ad_/; # change @ to '_ad_' $new_file =~ s/=/_equal_/; print to .$new_file. ... ; rename ($file, $new_file) ? print OK \n : print NOK error_n on $file, $new_file \n; } close 'fh'; hope this helps Michel -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Image::Magick Montage usage
Hi there, I have 189 gif images at 200x200 and I want to combine them in a 3x61 arrangement, ending up with a 600x12200 gif. Firstly is this just crazy talk? I realise this is a large image, but I've dealt with larger in the past. As long as you have the resources... Secondly, what the hell am I doing wrong!? My code is below. I have the image filenames in a file. The first bit of the code grabs the filenames (all 8 characters long) and sticks them into @images. After this, it all gets a bit hazy. When I run the code, it gets as far as Montaging...\n but then hangs (12 hours and counting) whle the CPU usage goes through the roof. Have you tried the same thing with only a few images? 189 is a fair number I suspect, try it with 3-4 see if you get the desired results, then add more, this could just be a resource issue. I used the code from here to create mine: http://savage.net.au/ImageMagick.html#ImageMagick_Hax_1_13 I would appreciate any pointers to where I'm going wrong, and also pointers to any documentation that might help me understand this better. [snip code] Your code looks correct based on a cursory glance at it and the docs. I would try fewer files first. I am not entirely sure I understand what a sequence of images is, I thought I did based on your description, but the docs almost make it sound like they are on top of each other, which doesn't make much sense as a montage. You might also try presetting the dimensions of the final image, that would prevent ImageMagick from having to recalculate it, though not sure why this would matter. If you find that the number of images is causing a problem you might try montaging them in sets, then montaging the sets together, this won't change your final image, and will increase the size of the images, but will reduce the number of tiles in one image. HTH, http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
True IP behind a router?
Hi, Is there any modules can check my true IP( NOT 192.168.x.x ) I am on while I am behind a router? Thanks in advise
Re: True IP behind a router?
Bee wrote: Hi, Is there any modules can check my true IP( NOT 192.168.x.x ) I am on while I am behind a router? You can use a Perl module (or external system call) to go to http://privacy.net/ which will show the router's IP at the top of the page. You can then use regex to grab the IP. -- Andrew Gaffney Network Administrator Skyline Aeronautics, LLC. 636-357-1548 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: True IP behind a router?
Hi, Is there any modules can check my true IP( NOT 192.168.x.x ) I am on while I am behind a router? Thanks in advise Are you the admin of the router? Aka is this a home router? http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: backreferences
On Mar 9, 2004, at 9:00 PM, Stuart White wrote: That got me started. I do have a question though about your regex. Good, better to ask and know, I think. Let's see if we can clear it up... This backreference is $1, and matches the team abbreviation. ([A-Z0-9 -]+) This one is $2, and matches the first name: (\w+) Full marks to here. You're right and right. And this one I'd think should be $3, and match Steal or Assist etc., but the results don't say that. (?:Steal|Assist|Block|replaced by) Stuart, I love your questions. ;) You're always missing one tiny piece of knowledge and you always ask them in such a way that I know exactly what it is. Here's the missing piece this time: You see that the above is surrounded by ( ) and you think that means it should capture. The truth is that the above is surrounded by (?: ), which happens to be ( )'s cousin. It groups things together, like ( ), but it does not capture. I had to cluster them so the |s would work, but I didn't need to hang onto the results, so I chose (?: ) over ( ). You could do it just fine with normal parenthesis, if you prefer. If you do, you just have to remember that your third answer is in $4, because $3 is holding some junk. Take your pick. Instead, $3 is this, and matches the second name. (\w+) If backreferences are supposed to be in parentheses, why isn't this (?:Steal|Assist|Block|replaced by) a backreference? I'm hoping this makes sense now. There are only three captures in my regex. (\w+) is the third. Can you see that now? James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: True IP behind a router?
Are you the admin of the router? Aka is this a home router? YES... but... any difference ?! http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: True IP behind a router?
Are you the admin of the router? Aka is this a home router? YES... but... any difference ?! You may want to check out the source for ddclient, it knows how to request the IP from a number of different routers. It then uses this request to update a dyn-dns record. I have been using it for over a year and it works pretty well. http://freshmeat.net/projects/ddclient/ http://linux.cudeso.be/linuxdoc/ddclient.php HTH, http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: True IP behind a router?
On Mar 10, 2004, at 6:26 AM, Bee wrote: Is there any modules can check my true IP( NOT 192.168.x.x ) I am on while I am behind a router? The problem here is that it is all dependent upon which type of DSL Router one is working with, and what the vendor offered in the way of an interface. One way to go about this type of problem is discussed at http://www.wetware.com/drieux/CS/Proj/DI704/ ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Sockets, Why can't I do this?
I get an unknown error from the command prompt. My goal was to fetch a list of numbers for the socket port. Maybe it's just an XP problem ?? #!perl -w my$hostprog = 'localhost'; if(open(LOG, ./log.txt)){ }else{print Couldn't open LOG;} use IO::Socket; use LWP::Simple; #get a list of socket numbers of the listening program my$numbers = get(http://$hostprog/updates/templates/listen.txt;); [EMAIL PROTECTED] = split(/\|/,$numbers); ##Open a Socket## my$socket; foreach((1121,@numbers)){if(get_sock($_)){last;}} sub get_sock{ my($number) = @_; print $number\n; $socket = new IO::Socket::INET( PeerAddr = $hostprog, PeerPort = $number, Type = SOCK_STREAM, Reuse = 1, Proto = 'tcp' ); if($socket){$socket-autoflush(1);print \n using $number;return 1;} } #wait for a response from client unless($socket){print Couldn't open socket., $!;exit(0)} while ($response = $socket-accept()) { # receive a request print LOG Connected from: , $response-peerhost(); # Display messages print LOG Port: , $response-peerport(), \n; my$result; # variable for Result while($response) { if(/^~~~end~~~/){last;} # if message is 'end' # then exit loop print LOG Received: $_; # Print received message #CHECK ALL THE SERVERNAMES ON THE BLACK LIST if(open(BAD, ../dt/no_templates.txt)){ while(BAD){ if(/^$servername$/){ print $response Error: A complaint against $servername has disabled this transfer.~~~end~~~; } } close(BAD); } #HERE YOU WANT TO GET THE TEMPLATE FILES AND SEND THEM BACK separated by ~~~===~~~ if(open(TEMPLATE, /$pkg::htmlroot/updates/templates/$_/template.txt)){ $send_files = TEMPLATE;$send_files .= '~~~===~~~'; close(TEMPLATE); }else{$send_files .= '~~~===~~~Error: template.txt';print LOG Error: template.txt\n;} if(open(KEYWORDS, /$pkg::htmlroot/updates/templates/$_/keywords.txt)){ $send_files .= KEYWORDS;$send_files .= '~~~===~~~'; close(KEYWORDS); }else{$send_files .= '~~~===~~~Error: keywords.txt';print LOG Error: keywords.txt\n;} if(open(AUTHOR, /$pkg::htmlroot/updates/templates/$_/author.txt)){ $send_files .= AUTHOR;$send_files .= '~~~===~~~'; close(AUTHOR); }else{$send_files .= '~~~===~~~Error: author.txt';print LOG Error: author.txt\n;} print $response BEGIN$send_files; # Send received message back # to verify } chomp; # Remove the if(/^~~~end~~~/){ # You need this. Otherwise if # the client terminates abruptly # The server will encounter an # error when it sends the result back # and terminate print $response ~~~end~~~; # send the result message print LOG Done sending files\n\n; # Display sent message } print LOG Closed connection\n; # Inform that connection to client is closed close $response; # close client print LOG Waiting...\n; # Wait again for next request }
Re: True IP behind a router?
That's a method, thank you. But I guess that 's not a good way for what I am going to do.. I'll try to scan my true IP by every 1 minute for a week. If that's difference from before, I'll log it down and suppose I got disconnected and reconnected.. I'll use this as a simple survey on tracking the disconnect ratio for ISPs.. So, I can't really keep on using it.. just like a ping attack ?! Thanks in advise - Original Message - From: Andrew Gaffney [EMAIL PROTECTED] To: beginners [EMAIL PROTECTED] Sent: Wednesday, March 10, 2004 10:30 PM Subject: Re: True IP behind a router? Bee wrote: Hi, Is there any modules can check my true IP( NOT 192.168.x.x ) I am on while I am behind a router? You can use a Perl module (or external system call) to go to http://privacy.net/ which will show the router's IP at the top of the page. You can then use regex to grab the IP. -- Andrew Gaffney Network Administrator Skyline Aeronautics, LLC. 636-357-1548 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Reading File grep according item 5 and sorting
On 7-mrt-04, at 00:00, R. Joseph Newton wrote: Bjorn Van Blanckenberg wrote: On 3-mrt-04, at 09:56, R. Joseph Newton wrote: I understand how the code works It reads the file end split every line according to the tabs and then sorts everything. For returning the info it looks at colomn 5 (1-based indexing) and if colomn 5 of the next line is the different print an extra newline. So it basically does what I want if colomn 5 is exact the same not if it start with string from colomn 5. So It is basically what I need but without reordering (sorting) and looking at every line that starts with colomn 5 and then sorts that blok of tekst. I hope I explaned it well enough. Thanks Well, that is good, but it leaves you having to do a lot of work over again, mostly because you handled things in a limp early on. That bit of code early on: my @sorted = map { $_-[0] } sort { $a-[5] cmp $b-[5] } map { [ $_ , (split /\s+/) ] } @fields; does a sort, then re-concatenates the lines as sorted. Then they have to be picked apart again in order to look for places to insert a newline. What you want to do will require design, not imitation. First, think about the requirements per line: While the fifth token in the line is the same [which none are, since they all have different decimals slopped onto the end], you wish to collect them in a group. Then you want to print out the items in the group line by line. If you want groups of lines, why are you throwing them together into a garbage bag of an array? my %fifth_item_groups; while (my $line = INFILE) { chomp $line; next unless $line; my @tokens = split /\s+/, $line; my $fifth_item = $tokens[4]; $fifth_item =~ s/\d+$//; $fifth_item_groups{$fifth_item} = [] unless $fifth_item_groups{$fifth_item}; push @{$fifth_item_groups{$fifth_item}}, [EMAIL PROTECTED]; } foreach my $grouping_key (sort {$a cmp $b} keys %fifth_item_groups) { print join(\t, @{$_}), \n foreach @{$fifth_item_groups{$grouping_key}}; print \n; } It looks like I have some problems with hashes. I changed that last block with foreach my $grouping_key (sort {$fifth_item_groups{$a} cmp $fifth_item_groups{$b}} keys %fifth_item_groups) { print join(\t, @{$_}), \n foreach @{$fifth_item_groups{$grouping_key}}; print \n; } and It works like a charm. Thanks again joseph The code above should perform the task specified--with no subsort. That work is for you to do. Hint: I chse my data structures pretty carefully, so that you should not have much trouble accessing any element by which you might wish to do a subsort. When you have made use of this and added the subsort, please post again and show us what you come up with. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- Oooo. oooO( ) ( ) ) / \ ( (_/ \_) Met vriendelijke groeten Bjorn Van Blanckenberg Technical Support Rechtstreeks nummer: ++32 3 780.68.41 -- PPC nv | Oostjachtpark 5 | 9100 St Niklaas Tel: ++32 3 777 04 44 | Fax: ++32 3 777 15 23 http://www.ppc.be -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Image::Magick Montage usage
Wiggins d Anconia wrote: HTH, Indeed, you're right of course. I have a hunch that this is more than a resource issue, but of course I should try using less images first to eliminate it as a possibility. I'll try later and let you know how I get on. I was kind of hoping someone would spot an obvious mistake in my code - no such luck :-) I did notice one mistake: my $output_file = 'home/james/montage_images/montage.gif'; # no leading '/' Where would this end up, or would it just throw an error? Or just work? I doubt it has anything to do with my problem anyway, just curious. -- james The information contained in this e-mail is intended for the recipient or entity to whom it is addressed. It may contain confidential information that is exempt from disclosure by law and if you are not the intended recipient, you must not copy, distribute or take any act in reliance on it. If you have received this e-mail in error, please notify the sender immediately and delete from your system. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Image::Magick Montage usage
Wiggins d Anconia wrote: HTH, Indeed, you're right of course. I have a hunch that this is more than a resource issue, but of course I should try using less images first to eliminate it as a possibility. I'll try later and let you know how I get on. I was kind of hoping someone would spot an obvious mistake in my code - no such luck :-) I did notice one mistake: my $output_file = 'home/james/montage_images/montage.gif'; # no leading '/' Where would this end up, or would it just throw an error? Or just work? I doubt it has anything to do with my problem anyway, just curious. Possibly this could be the problem, though I would have hoped Image::Magick to throw an exception or some such if the file was not writeable instead of hanging. It should just throw an error, unless it builds the full path under your cwd, but I doubt its that smart. I also notice that you catch the return result of 'Write' and then warn if it is positive, but 'Write' returns the number of images written, so it should be positive. I suspect this is because it is just test code, but you will likely need to correct that before release. One more suggestion I had in light of these findings, would be to add a print statement after the Montage before the Write so we can confirm that the script is in fact hanging at the Montage rather than at the Write. http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Image::Magick Montage usage
Wiggins d Anconia wrote: I also notice that you catch the return result of 'Write' and then warn if it is positive, but 'Write' returns the number of images written, so it should be positive. I suspect this is because it is just test code, but you will likely need to correct that before release. You're right about this one. The example code in im-hax-montage-1.pl (see earlier url) uses this code and I just duplicated the error. One more suggestion I had in light of these findings, would be to add a print statement after the Montage before the Write so we can confirm that the script is in fact hanging at the Montage rather than at the Write. Another good idea, which I shall try tonight along with the others, or this afternoon if I can get Image::Magick installed on my work PC. That's another story! Thanks for the suggestions, -- james The information contained in this e-mail is intended for the recipient or entity to whom it is addressed. It may contain confidential information that is exempt from disclosure by law and if you are not the intended recipient, you must not copy, distribute or take any act in reliance on it. If you have received this e-mail in error, please notify the sender immediately and delete from your system. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: backreferences
--- James Edward Gray II [EMAIL PROTECTED] snip And this one I'd think should be $3, and match Steal or Assist etc., but the results don't say that. (?:Steal|Assist|Block|replaced by) Stuart, I love your questions. ;) You're always missing one tiny piece of knowledge and you always ask them in such a way that I know exactly what it is. Here's the missing piece this time: You see that the above is surrounded by ( ) and you think that means it should capture. The truth is that the above is surrounded by (?: ), which happens to be ( )'s cousin. It groups things together, like ( ), but it does not capture. I had to cluster them so the |s would work, but I didn't need to hang onto the results, so I chose (?: ) over ( ). You could do it just fine with normal parenthesis, if you prefer. If you do, you just have to remember that your third answer is in $4, because $3 is holding some junk. Take your pick. Geez, I can't recall them covering (?: ) in my books...D'oh! The part about it grouping and capturing things makes sense, as it's the cousin of ( ). The part about being able to include the |'s doesn't. I found out, without knowing at the time, that the parentheses breakdown with |'s. I didn't know it at the time, but when I put the ORs in the parentheses and ran the program, I just got the command prompt, no output. Your explanation tells me that (?: ) could capture the ORs, and implies that the ( ) could not. --This part makes sense, as i'll just regard it as a rule. But then you go on to say that I could still use it with ( ), but then $3 would contain junk and $4 would contain the name after the (?:Steal|Assist|Block|replaced by). I'm assuming that junk in $3 would be either Assist or Block or Steal or replaced by, is that correct? I ask this because later, perhaps two days from now, perhaps two weeks from now, I'm going to want that information, assuming it is Assist or Block or Steal or replaced by. Do I just put (:? ) within ( )? That sortof makes sense, but it also seems, I'm not sure what the right word is, but it doesn't seem right. Lastly, I'm curious about this (:? ) operator. I'm going to look it up, but assuming that perldoc is not going to explain it sufficiently for me, as is often the case, do you mind telling me why it is needed to get the |'s, if that also applies to , and numerical and word comparison operators? Thanks. Instead, $3 is this, and matches the second name. (\w+) If backreferences are supposed to be in parentheses, why isn't this (?:Steal|Assist|Block|replaced by) a backreference? I'm hoping this makes sense now. There are only three captures in my regex. (\w+) is the third. Can you see that now? It does, and I can. Oh, and I appreciate when you not only answer a question with an explanation, but you use an example as well. That's extremely helpful. -stu James __ Do you Yahoo!? Yahoo! Search - Find what youre looking for faster http://search.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: urgent need for installing perl 5.8.0
Nilay Puri wrote: I downloaded perl 5.8.0 from search.cpan.org While running make , I am getting this error : Can anyone throw some light about the cause: Making Errno (nonxs) make[1]: Entering directory `/perl-5.8.0/ext/Errno' Makefile out-of-date with respect to ../../lib/Config.pm ../../config.h Cleaning current config before rebuilding Makefile... make -f Makefile.old clean /dev/null 21 || /bin/sh -c true ../../miniperl -I../../lib -I../../lib Makefile.PL INSTALLDIRS=perl PERL_ CORE=1 LIBPERL_A=libperl.a Writing Makefile for Errno == Your Makefile has been rebuilt. == == Please rerun the make command. == false make[1]: *** [Makefile] Error 255 make[1]: Leaving directory `/perl-5.8.0/ext/Errno' make config failed, continuing anyway... make[1]: Entering directory `/perl-5.8.0/ext/Errno' ../../miniperl -I../../lib -I../../lib -I../../lib -I../../lib Errno_pm. PL Errno.pm sh: cc: not found No error definitions found at Errno_pm.PL line 180. make[1]: *** [Errno.pm] Error 1 make[1]: Leaving directory `/perl-5.8.0/ext/Errno' make: *** [ext/Errno/pm_to_blib] Error 2 what's your configure command? make can't find cc which means you either do not have cc installed or cc is not in your path. if it's the first case, you need to specify a C compiler for your machine. if it's the later, you need to make sure cc is in your path so make can find it. david -- s$s*$+/tgmecJntgRtgjvqpCvuwL$;$;=qq$ \x24\x5f\x3d\x72\x65\x76\x65\x72\x73\x65 \x24\x5f\x3b\x73\x2f\x2e\x2f\x63\x68\x72 \x28\x6f\x72\x64\x28\x24\x26\x29\x2d\x32 \x29\x2f\x67\x65\x3b\x70\x72\x69\x6e\x74 \x22\x24\x5f\x5c\x6e\x22\x3b\x3b$;eval$; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Image::Magick Montage usage
Taylor James wrote: Another good idea, which I shall try tonight along with the others, or this afternoon if I can get Image::Magick installed on my work PC. That's another story! Done that, and revised the code as discussed earlier and it still seems to be hangign at the same point (just after Montaging...\n;) despite now trying to montage a 3x3 square. Any ideas welcomed. Revised code (now on Win32): # #!/usr/bin/perl use warnings; use strict; use Image::Magick; my @images; my $input_file = 'H:\amalgam.txt'; my $output_file = 'H:\test.gif'; my $image_dir = 'E:\tiles\\'; my $result; open IN, $input_file or die Couldn't read $input_file: $!\n; while (IN) { chomp; if (/([A-Z0-9]{8}\.gif)/){ push (@images, $1); } else { print Couldn't match a line in $input_file - $_; } } my($image) = Image::Magick - new(); my($stack) = Image::Magick - new(); my $counter = 1; for (1..3) { for (1..3) { my $tile = pop @images; $result = $image - Read($image_dir.$tile); warn $result if $result; push (@$stack, $image); print $tile seen ($counter)\n; $counter++; } } print Montaging...\n; my($final) = $stack - Montage ( tile= '3x3', geometry= '200x200' ); print Montaged\n; $result = $final - Write($output_file); warn $result if $result; print Success. Wrote $output_file. \n; The information contained in this e-mail is intended for the recipient or entity to whom it is addressed. It may contain confidential information that is exempt from disclosure by law and if you are not the intended recipient, you must not copy, distribute or take any act in reliance on it. If you have received this e-mail in error, please notify the sender immediately and delete from your system. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Sockets, Why can't I do this?
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: : : I get an unknown error from the command prompt. Care to share the error with us? HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: backreferences
On Mar 10, 2004, at 10:20 AM, Stuart White wrote: Geez, I can't recall them covering (?: ) in my books...D'oh! It may not have. It's not super common to see it thrown about. Most people just use (...), I would guess. The part about it grouping and capturing things makes sense, as it's the cousin of ( ). The part about being able to include the |'s doesn't. I found out, without knowing at the time, that the parentheses breakdown with |'s. I didn't know it at the time, but when I put the ORs in the parentheses and ran the program, I just got the command prompt, no output. Hmm. this still sounds a little confused. Let's us another example: #!/usr/bin/perl use strict; use warnings; while (DATA) { print \nLine: $_; if (m/\[([A-Z0-9 -]+)\] (\w+).+(?:Steal|Assist|Block|replaced by):? (\w+)/) { print \tMatched: \\[([A-Z0-9 -]+)\\] (\\w+).+(?:Steal|Assist|Block|replaced by):? (\\w+)\n; print \t\t\$1 is $1\n\t\t\$2 is $2\n\t\t\$3 is $3\n; } if (m/\[([A-Z0-9 -]+)\] (\w+).+(Steal|Assist|Block|replaced by):? (\w+)/) { print \tMatched: \\[([A-Z0-9 -]+)\\] (\\w+).+(Steal|Assist|Block|replaced by):? (\\w+)\n; print \t\t\$1 is $1\n\t\t\$2 is $2\n\t\t\$3 is $3\n\t\t\$4 is $4\n; } } __DATA__ (10:18) [PHX] Stoudemire Turnover: Lost Ball (1 TO) Steal: Jackson (1 ST) (10:51) [SAN 4-0] Jackson Jump Shot: Made (2 PTS) Assist: Duncan (1 AST) (9:33) [SAN] Duncan Layup Shot: Missed Block: Stoudemire (2 BLK) (5:35) [SAN] Bowen Substitution replaced by Ginobili When I run the above, I get: Line: (10:18) [PHX] Stoudemire Turnover: Lost Ball (1 TO) Steal: Jackson (1 ST) Matched: \[([A-Z0-9 -]+)\] (\w+).+(?:Steal|Assist|Block|replaced by):? (\w+) $1 is PHX $2 is Stoudemire $3 is Jackson Matched: \[([A-Z0-9 -]+)\] (\w+).+(Steal|Assist|Block|replaced by):? (\w+) $1 is PHX $2 is Stoudemire $3 is Steal $4 is Jackson Line: (10:51) [SAN 4-0] Jackson Jump Shot: Made (2 PTS) Assist: Duncan (1 AST) Matched: \[([A-Z0-9 -]+)\] (\w+).+(?:Steal|Assist|Block|replaced by):? (\w+) $1 is SAN 4-0 $2 is Jackson $3 is Duncan Matched: \[([A-Z0-9 -]+)\] (\w+).+(Steal|Assist|Block|replaced by):? (\w+) $1 is SAN 4-0 $2 is Jackson $3 is Assist $4 is Duncan Line: (9:33) [SAN] Duncan Layup Shot: Missed Block: Stoudemire (2 BLK) Matched: \[([A-Z0-9 -]+)\] (\w+).+(?:Steal|Assist|Block|replaced by):? (\w+) $1 is SAN $2 is Duncan $3 is Stoudemire Matched: \[([A-Z0-9 -]+)\] (\w+).+(Steal|Assist|Block|replaced by):? (\w+) $1 is SAN $2 is Duncan $3 is Block $4 is Stoudemire Line: (5:35) [SAN] Bowen Substitution replaced by Ginobili Matched: \[([A-Z0-9 -]+)\] (\w+).+(?:Steal|Assist|Block|replaced by):? (\w+) $1 is SAN $2 is Bowen $3 is Ginobili Matched: \[([A-Z0-9 -]+)\] (\w+).+(Steal|Assist|Block|replaced by):? (\w+) $1 is SAN $2 is Bowen $3 is replaced by $4 is Ginobili Notice that they are nearly identical matches, I just changed the (?:...) to (...) in the second one. They function the same, the variables set by the expression is the only difference. (?:...) doesn't set a variable. Your other confusion seems to be the | character. You seem to think it's a Perl or symbol. Not true. We're inside a regex here, gotta switch thinking. Regex knowledge in, Perl out. | is a regex alternation character, which pretty much means find this or this, as expected. That's probably why the symbol was chosen, looks like the or operators of many languages. However, note that isn't significant in a regex. Now, let's get to why | needs the (?:...) or (...) around it. If they weren't there, my regex would read like this: Find \[([A-Z0-9 -]+)\] (\w+).+Steal OR Assist OR Block OR replaced by:? (\w+) Instead, it reads like this: Find \[([A-Z0-9 -]+)\] (\w+).+ Followed By Steal OR Assist OR Block OR replaced by Followed By :? (\w+) As you can see, I need the parenthesis to keep the oring behavior of | from going to far. Hopefully that makes sense. You might take a trip back to the regex section of your books, if | is new to you. It's regex 101 and I would be super surprised if it isn't covered. James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: backreferences
--- James Edward Gray II [EMAIL PROTECTED] wrote: On Mar 10, 2004, at 10:20 AM, Stuart White wrote: Geez, I can't recall them covering (?: ) in my books...D'oh! It may not have. It's not super common to see it thrown about. Most people just use (...), I would guess. Ahh, ok. So, like you said, (?: ) is just for grouping things. I can see how that might be useful. Thanks. The part about it grouping and capturing things makes sense, as it's the cousin of ( ). The part about being able to include the |'s doesn't. I found out, without knowing at the time, that the parentheses breakdown with |'s. I didn't know it at the time, but when I put the ORs in the parentheses and ran the program, I just got the command prompt, no output. Hmm. this still sounds a little confused. When I look at your regex, I think now that perhaps it wasn't the ( ) that were written incorrectly by me, but rather, my mistake in not accounting for the digits in the brackets where the Team is, or the .+ instead of just the . in between $2 and $3. this makes sense, because in Beginning Perl, it has quite a few examples of | within ( ), which is why I didn't think it'd be a problem in the first place. Let's us another example: The second regex: if (m/\[([A-Z0-9 -]+)\](\w+).+ (Steal|Assist|Block|replaced by):? (\w+)/) is what I want. This example makes sense too. Notice that they are nearly identical matches, I just changed the (?:...) to (...) in the second one. They function the same, the variables set by the expression is the only difference. (?:...) doesn't set a variable. Got it. Your other confusion seems to be the | character. You seem to think it's a Perl or symbol. Not true. We're inside a regex here, gotta switch thinking. Regex knowledge in, Perl out. | is a regex alternation character, which pretty much means find this or this, as expected. That's probably why the symbol was chosen, looks like the or operators of many languages. However, note that isn't significant in a regex. Yup, simple mistake. It's been awhile since I read about | in regex, but I remember now that it is an alternation character. I certainly did get confused in my last post though. Thanks for the clarification. Now, let's get to why | needs the (?:...) or (...) around it. If they weren't there, my regex would read like this: This part I understood. I was confused before because I thought that (...) broke down when | was used, and that to circumvent that, one would use (?:...) instead. You might take a trip back to the regex section of your books, if | is new to you. It's regex 101 and I would be super surprised if it isn't covered. It's covered. I'll be looking at that at lunchtime. Thanks. James __ Do you Yahoo!? Yahoo! Search - Find what youre looking for faster http://search.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Replace a string in a text file
Hello, I have a text file (texst1.txt) that reads: The quick brown fox jumped over the lazy dog. I would like to replace the word fox with coyote. Is there an easier/simpler/cooler way to do this? #!/usr/bin/perl -w use strict; open (FILE, test1.txt); open (NEWFILE, tmp); while (FILE) { if ($_ =~ /fox/) { s/fox/coyote/; } print NEWFILE $_; } close FILE; close NEWFILE; unlink test1.txt; rename tmp, test1.txt; Thanks, Greg -- __ Check out the latest SMS services @ http://www.linuxmail.org This allows you to send and receive SMS through your mailbox. Powered by Outblaze -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Read from tape device
[EMAIL PROTECTED] wrote: I am trying to read some data from af unix tape device. The have several files with end of file markers. Can I read from tape devices at all? I tried open on the device and this one reads all files on the tape into the first file and then hangs. Is it my code (I know the first loop is not very good:-) or does perl not recognise or honer the EOF marks? The first loop is not very good indeed, since it's an infinite loop. Just few tips to get you started: my $cnt = 0; while (1 == 1) { This is an infinite loop. It keeps running while 1 equals 1, i.e. pretty much always. This is why your program hangs. open IN, , /dev/nst0 || die cant open ...\n; die is never run, because the string /dev/nst0 is never false. Run this: perl -le 'open F, , /no/such/file || die; print OK' It prints OK. Read the first paragraph of perldoc perlop SYNOPSIS about operators precedence. while (@out = IN) { It reads the entire file (tape) all at once and store its lines in @out array. Read I/O Operators in perldoc perlop. $cnt++; open OUT, , $cnt.bin || die cant open out\n; Again, die is never reached here. print OUT @out\n; This is equivalent to: print OUT join($, @out), \n; which is most likely equivalent to: print OUT join( , @out), \n; which is probably not what you want. close OUT; } } This is never reached because the above curly is enclosing an infinite loop without an explicit last command. close IN; What do you mean by 'several files with end of file markers'? Is it a stream of your original files concatenated with ^D, \cd inserted in between them? Are those only text files with no ^D in them? Does this command: less -f /dev/nst0 show those text files? Does this command: less -fE /dev/nst0 show the first one of them? Are you sure the files on tape are not stored in a tarfile format? You have to describe how does your data look like. -- ZSDC Perl and Systems Security Consulting -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Replace a string in a text file
On Mar 10, 2004, at 12:56 PM, Mr Mojo wrote: Hello, I have a text file (texst1.txt) that reads: The quick brown fox jumped over the lazy dog. I would like to replace the word fox with coyote. Is there an easier/simpler/cooler way to do this? #!/usr/bin/perl -w use strict; open (FILE, test1.txt); open (NEWFILE, tmp); while (FILE) { if ($_ =~ /fox/) { s/fox/coyote/; } print NEWFILE $_; } close FILE; close NEWFILE; unlink test1.txt; rename tmp, test1.txt; perl -pi -e 's/fox/coyote' text_file_name_here.txt Is that cool enough? ;) James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Replace a string in a text file
Use this from unix prompt : sed s/fox/coyote/g test.txt tmp --Jay -Original Message- From: Mr Mojo [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 10, 2004 1:57 PM To: [EMAIL PROTECTED] Subject: Replace a string in a text file Hello, I have a text file (texst1.txt) that reads: The quick brown fox jumped over the lazy dog. I would like to replace the word fox with coyote. Is there an easier/simpler/cooler way to do this? #!/usr/bin/perl -w use strict; open (FILE, test1.txt); open (NEWFILE, tmp); while (FILE) { if ($_ =~ /fox/) { s/fox/coyote/; } print NEWFILE $_; } close FILE; close NEWFILE; unlink test1.txt; rename tmp, test1.txt; Thanks, Greg -- __ Check out the latest SMS services @ http://www.linuxmail.org This allows you to send and receive SMS through your mailbox. Powered by Outblaze -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Replace a string in a text file
James Edward Gray II wrote: On Mar 10, 2004, at 12:56 PM, Mr Mojo wrote: I have a text file (texst1.txt) that reads: The quick brown fox jumped over the lazy dog. I would like to replace the word fox with coyote. Is there an easier/simpler/cooler way to do this? perl -pi -e 's/fox/coyote' text_file_name_here.txt Note that if you are running Windows the -i switch will not work correctly without a value. Also the closing '/' is missing. :-) John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
How to make object properties accessible by same-named function
Hi, I saw this neat trick while looking at AppConfig.pm on CPAN. It lets you define configuration variables in a file and, having read them, access them either by name-as-string OR as a function having the name of the variable, like so (copied from the CPAN documentation): # create/define combined my $config = AppConfig-new(\%cfg, $varname = \%varopts, $varname = \%varopts, ...); # set/get the value $config-set($varname, $value); $config-get($varname); # shortcut form $config-varname($value); $config-varname(); It's that last part labeled shortcut form that I'm interested in. I've read through the module's code once and didn't catch the part where they auto-define the var-named functions for you. What should I be looking for, and/or how would one implement this? Obviously I could just write subroutines having the same names as configuration variables, but it's the automagically appears aspect that looks especially useful. TIA. -- 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 to make object properties accessible by same-named function
Hi, I saw this neat trick while looking at AppConfig.pm on CPAN. It lets you define configuration variables in a file and, having read them, access them either by name-as-string OR as a function having the name of the variable, like so (copied from the CPAN documentation): # create/define combined my $config = AppConfig-new(\%cfg, $varname = \%varopts, $varname = \%varopts, ...); # set/get the value $config-set($varname, $value); $config-get($varname); # shortcut form $config-varname($value); $config-varname(); It's that last part labeled shortcut form that I'm interested in. I've read through the module's code once and didn't catch the part where they auto-define the var-named functions for you. What should I be looking for, and/or how would one implement this? Obviously I could just write subroutines having the same names as configuration variables, but it's the automagically appears aspect that looks especially useful. TIA. I believe this is handled with Autoloading. Check out the Autoloading section of perldoc perlsub for more. In particular check out the AUTOLOAD method of the AppConfig::State module source: http://search.cpan.org/src/ABW/AppConfig-1.56/lib/AppConfig/State.pm The comments before it discuss it a little. http://danconia.org -- 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 to make object properties accessible by same-named function
On Wed, Mar 10, 2004 at 02:16:50PM -0600, Michael C. Davis wrote: Hi, I saw this neat trick while looking at AppConfig.pm on CPAN. It lets you define configuration variables in a file and, having read them, access them either by name-as-string OR as a function having the name of the variable, like so (copied from the CPAN documentation): # create/define combined my $config = AppConfig-new(\%cfg, $varname = \%varopts, $varname = \%varopts, ...); # set/get the value $config-set($varname, $value); $config-get($varname); # shortcut form $config-varname($value); $config-varname(); It's that last part labeled shortcut form that I'm interested in. I've read through the module's code once and didn't catch the part where they auto-define the var-named functions for you. What should I be looking for, and/or how would one implement this? Obviously I could just write subroutines having the same names as configuration variables, but it's the automagically appears aspect that looks especially useful. The magic is in the AUTOLOAD sub. perldoc perlsub for more details. The following code is hacked out from one of my modules and pared down: sub AUTOLOAD { my $func = $AUTOLOAD; $func =~ s/^.*:://; no strict refs; *$func = sub { ... }; goto $func } -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
MMOE (Mega Multiplayer Online Experience)
Flash Front-end. Perl or possibly ASP back - end. Will be a very fun project. if anyone wants details email me. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Change file names
Eurospace Szarindar wrote: De: Tomas Corral [mailto:[EMAIL PROTECTED] Because '@' is a special character for many interpreters. I'm trying to change the names of 100 files deleting the '@' symbol. The filenames look like this: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] Try this little and simple script : #!/usr/bin/perl -w use strict; open 'fh' ,'ls ./[EMAIL PROTECTED] |'; # create a file handle You should *ALWAYS* verify that open() succeeded and since you are forking a separate process you should verify that close() succeeded as well. But you don't need to run a separate process to do something that you can do directly in perl with opendir/readdir/closedir or glob. my @file_list = (fh); ^^ There is only one operator so using parentheses to set precedence is superfluous. scalar (@file_list) or die There is no file to change; chomp(@file_list); foreach my $file (@file_list) { print renaming . $file; my $new_file = $file; $new_file =~ s/@/_ad_/; # change @ to '_ad_' $new_file =~ s/=/_equal_/; print to .$new_file. ... ; rename ($file, $new_file) ? print OK \n : print NOK error_n on $file, $new_file \n; You should include the $! variable in the error message so you know why it failed. } close 'fh'; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Looking at .ini files
Hello, How do I go about looking at remote hosts .ini file? I am looking for a particular value inside the file to the accord of TERM= I would like to save a list of computer names with the values on a separate file. Can I do this in PERL? Can you point me in the right direction? Thanks in advance, Alden -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Change file names
On Wed, Mar 10, 2004 at 02:42:39PM +0100, EUROSPACE SZARINDAR wrote: -Message d'origine- De: Tomas Corral [mailto:[EMAIL PROTECTED] Because '@' is a special character for many interpreters. I'm trying to change the names of 100 files deleting the '@' symbol. The Try this little and simple script : A certain Larry Wall wrote a rename script that came bundled with Perl for a long time. Here's a later version which is shipped with debian: http://www.hurontel.on.ca/~barryp/menu-mysql/music_rename-1.12c/rename -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Looking at .ini files
Meneses, Alden wrote: Hello, How do I go about looking at remote hosts .ini file? I am looking for a particular value inside the file to the accord of TERM= You would need read capabiliity (obviously) on the remote machine and I am assuming you know where that file resides. You should be able to open for read and do your search along the liens of: open(FILEIN, '' . $MyRemoteFile) || die Unable to open for read file $MyRemoteFile: $! while ( FILEIN ) { chomp; if ( /term=.+/i ) { # now do something with the line # if there can only be one per file then you could do last. If multiples } } close(FILEIN); A start. Wags ;) I would like to save a list of computer names with the values on a separate file. Can I do this in PERL? Can you point me in the right direction? Thanks in advance, Alden Any questions and/or problems, please let me know. Thanks. Wags ;) Int: 9-8-002-2224 Ext: 408-323-4225x2224 ** This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Replace a string in a text file
Mr Mojo wrote: I have a text file (texst1.txt) that reads: The quick brown fox jumped over the lazy dog. I would like to replace the word fox with coyote. Is there an easier/simpler/cooler way to do this? You can run this from the command line: perl -pi -es/fox/coyote/g test1.txt Or if you want to have a backup in test1.txt~: perl -pi~ -es/fox/coyote/g test1.txt or in test1.txt.bak: perl -pi.bak -es/fox/coyote/g test1.txt See perldoc perlrun for the command line switches. If you want to save this script in a file, write: #!/usr/bin/perl -pi~ s/fox/coyote/g; and run it with your file as an argument: ./script test1.txt As for your program, I might have few suggestions: #!/usr/bin/perl -w use strict; You might prefer use warnings instead of -w for better control of warnings. See: perldoc perllexwarn open (FILE, test1.txt); open (NEWFILE, tmp); Always add at least 'or die $!' when you are opening files, because it can fail for many reasons: open FILE, test1.txt or die Error opening test1.txt: $!\n; open NEWFILE, tmp or die Error opening tmp: $!\n; You probably want '' instead of '' here. If there already is a file named 'tmp' opening it with '' will append new lines at the end, while '' will truncate it first. See: perldoc perlopentut If you don't want to add or die to every command which can fail, you may write something like this instead: use Fatal qw(open close unlink rename); at the beginning of your program. while (FILE) { if ($_ =~ /fox/) { s/fox/coyote/; } print NEWFILE $_; } The if ($_ =~ /fox/) is redundant, because s/fox/coyote/ will change only lines with fox anyway. s/fox/coyote/ will only change the first fox in every line. Use s/fox/coyote/g to change every one if there are more foxes in any single line. $_ is default for print. So the above is equivalent to: while (FILE) { s/fox/coyote/; print NEWFILE; } close FILE; close NEWFILE; unlink test1.txt; rename tmp, test1.txt; You might also check the return values of unlink and rename to die if they fail: unlink test1.txt or die Unlinking test1.txt: $!\n; rename tmp, test1.txt or die Renamimg tmp: $!\n; or at least: unlink test1.txt or die $!; rename tmp, test1.txt or die $!; Or you can use the trick with use Fatal instead. In the examples I showed above you always had to give file name as an argument, while the file name is hardcoded into your program. To have exactly the same functionality, you might write this program: #!/usr/bin/perl -wpi BEGIN [EMAIL PROTECTED] = 'test1.txt'} s/fox/coyote/g; It does the same as yours with only few exceptions: it prints an error when it can't open the file: Can't open test1.txt: No such file or directory. It changes every fox to coyote and not only the first one in a line (thanks to the g at the end of substitution, see: perldoc perlre) and it won't include any old tmp file if there is any. The above program even if cool (for some definition of coolness) may be quite hard to understand at first, so if you have any questions I can explain it in more details. -- ZSDC Perl and Systems Security Consulting -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Replace a string in a text file
Jayakumar Rajagopal wrote: Use this from unix prompt : sed s/fox/coyote/g test.txt tmp Hey, this is not [EMAIL PROTECTED] mailing list! ;) -- ZSDC Perl and Systems Security Consulting -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Nucleotide Sequencing
I am a fresh starter of Perl and I need to write a script that perform the same function done by the following JavaScript. I know it is wrong to ask for code but I am in urgent requirement of this. The javascript code is as follows script language=JavaScript !-- function transl() { translation = new Array(cga,cgc,cgg,cgu,aga,agg,cua,cuc,cug,cuu,uua,uug,uca,ucc,ucg,ucu,agc,agu,aca,acc,acg,acu,cca,ccc,ccg,ccu,gca,gcc,gcg,gcu,gga,ggc,ggg,ggu,gua,guc,gug,guu,aaa,aag,aac,aau,caa,cag,cac,cau,gaa,gag,gac,gau,uac,uau,ugc,ugu,uuc,uuu,aua,auc,auu,aug,ugg,uaa,uag,uga); treelett = new Array(Arg,Arg,Arg,Arg,Arg,Arg,Leu,Leu,Leu,Leu,Leu,Leu,Ser,Ser,Ser,Ser,Ser,Ser,Thr,Thr,Thr,Thr,Pro,Pro,Pro,Pro,Ala,Ala,Ala,Ala,Gly,Gly,Gly,Gly,Val,Val,Val,Val,Lys,Lys,Asn,Asn,Gln,Gln,His,His,Glu,Glu,Asp,Asp,Tyr,Tyr,Cys,Cys,Phe,Phe,Ile,Ile,Ile,Met,Trp,Stop_ochre,Stop_amber,Stop_opal); onelett = new Array(r,r,r,r,r,r,l,l,l,l,l,l,s,s,s,s,s,s,t,t,t,t,p,p,p,p,a,a,a,a,g,g,g,g,v,v,v,v,k,k,n,n,q,q,h,h,e,e,d,d,y,y,c,c,f,f,i,i,i,m,w,*,*,*); freq = new Array(6.3,10.8,11.6,4.6,11.5,11.3,7.0,19.3,39.7,12.8,7.3,12.5,11.9,17.5,4.5,14.8,19.3,12.0,14.9,19.3,6.3,12.9,16.7,20.0,7.0,17.3,15.9,28.3,7.5,18.5,16.4,22.7,16.4,10.8,7.0,14.6,28.8,10.9,24.0,32.6,19.8,17.0,12.0,34.5,14.9,10.5,29.1,40.2,26.1,22.4,15.8,12.1,12.3,10.0,20.5,17.0,7.2,21.6,15.8,22.3,12.9,0.7,0.5,1.3, 6.7,10.1,10.5,4.7,11.4,11.6,7.5,19.6,39.3,12.3,6.0,12.5,11.2,18.1,4.5,15.4,20.0,12.2,15.6,19.6,6.1,13.2,17.3,19.1,6.8,18.7,15.5,26.7,7.1,19.7,17.3,22.9,15.9,11.7,6.9,15.6,29.0,10.1,21.3,34.6,21.5,15.5,11.6,34.5,15.3,9.9,26.9,40.3,27.5,21.4,16.8,11.8,12.6,10.9,21.6,16.0,6.6,22.9,14.6,22.2,12.9,0.6,0.5,1.1, 8.5,17.9,8.3,8.7,5.1,6.4,8.3,13.9,38.7,9.1,4.3,16.2,7.6,19.6,16.6,6.8,20.4,11.5,10.7,21.4,14.4,9.5,13.5,17.9,16.0,6.9,12.8,33.6,14.0,14.5,17.8,26.6,4.7,13.3,6.3,13.9,28.1,10.9,16.5,39.5,26.1,20.8,15.6,36.8,16.2,10.6,20.9,43.0,24.7,27.6,18.4,10.7,13.3,5.3,21.8,13.1,9.3,23.0,16.5,23.5,9.9,0.8,0.6,0.5, 6.3,3.7,4.8,8.8,19.0,10.9,10.1,15.7,10.0,24.2,13.2,21.3,18.3,10.9,9.0,25.0,11.2,14.3,15.9,10.1,7.6,17.6,16.1,5.2,8.2,18.3,17.4,10.0,8.6,27.5,23.5,8.9,10.1,21.7,10.2,12.5,17.3,27.2,31.3,32.5,20.7,23.1,19.7,15.0,8.6,14.1,35.0,32.1,17.1,37.2,13.5,15.2,7.2,10.9,20.3,22.7,13.1,18.3,22.1,24.4,12.6,0.9,0.5,1.0, 3.0,2.6,1.7,6.5,21.3,9.3,13.4,5.4,10.4,12.2,26.4,27.1,18.8,14.2,8.6,23.6,9.7,14.2,17.7,12.6,8.0,20.2,18.2,6.8,5.3,13.6,16.2,12.6,6.1,21.1,10.9,9.7,6.0,23.9,11.8,11.6,10.7,22.0,42.1,30.8,24.9,36.0,27.5,12.2,7.8,13.7,45.9,19.1,20.3,37.8,14.7,18.8,4.7,8.0,18.2,26.0,17.8,17.1,30.2,20.9,10.3,1.0,0.5,0.6, 3.5,20.6,5.4,20.6,2.8,1.7,4.0,10.3,50.4,11.2,13.9,13.1,8.1,9.1,8.6,9.9,15.3,9.2,8.2,22.8,13.8,10.0,8.6,5.1,22.0,7.2,21.0,24.5,31.8,16.8,8.7,28.4,11.0,25.9,11.4,14.6,25.2,19.6,34.8,11.5,21.8,19.2,14.7,28.6,9.6,12.6,39.7,18.2,19.5,32.6,12.3,16.9,6.2,5.1,16.4,21.9,5.6,24.4,30.1,26.8,13.9,2.0,0.2,0.9); organism = new Array(Homo sapiens,Mus musculus,Drosophila melanogaster,Arabidopsis thaliana,Saccharomyces cerevisiae,Escherichia coli); // çàáèðàåì çíà÷åíèÿ, çàäàííûå â ôîðìå org = document.ftransl.org.selectedIndex; str = document.ftransl.str.value; r = parseFloat(document.ftransl.r.value); if(isNaN(r)||r==0){alert(\Critical frequency (per 1000)\ should be number.); document.ftransl.r.focus(); return true;}; r = Math.abs(r); document.ftransl.r.value = r; name_seq = document.ftransl.s_name.value; // ïðèâîäèì str ê ñòàíäàðòíîìó âèäó êîòîðûé áóäåò íàçûâàòüñÿ nseq nseq = nseq = str.toLowerCase(); nseq = nseq.replace(/t/g,u); nseq = nseq.replace(/[^agcu]/g,); lnseq = nseq.length; if(lnseq3){alert(The sequence should be at least three nucleotides long.); document.ftransl.str.focus(); return true;}; // òðàíñëèðóåì íóêëåîòèäíóþ ïîñëåäîâàòåëüíîñòü â íîìåðà, ñîîòâåòñòâóþùèå èíäèâèäóàëüíûì êîäîíàì aa = new Array() prot = brnbsp;nbsp;nbsp;nbsp;nbsp;1nbsp;nbsp;; aalett = ; codseq = ; i3 = 0; aalength = Math.floor(nseq.length/3); while(i3aalength) { i3++; i4 = 0; while(i464) {i4++; if(nseq.substring(i3*3-3,i3*3)==translation[i4-1]) {aa[i3-1] = i4-1; break};} } i10 = 0; while(i10aalength) {i10++; codseq =codseq + i10 + -- + nseq.substring(i10*3-3,i10*3) + -- + treelett[aa[i10-1]] + -- + freq[64*org+aa[i10-1]] + \n; t_letter = onelett[aa[i10-1]] if(freq[64*org+aa[i10-1]]r) { t_letter = t_letter.toUpperCase(); t_letter = t_letter.bold(); t_letter = t_letter.fontcolor(red); } prot = prot + t_letter; if(Math.floor(i10/10)*10==i10) {prot = prot + } if(Math.floor(i10/50)*50==i10) { p_str = i10+1 pp = Math.log(p_str)/Math.log(10); prot = prot +br for(i8=0;i85-pp;i8++) {prot = prot +nbsp; }; prot = prot + p_str + nbsp;nbsp;} } document.ftransl.codseq.value = codseq; id = window.open('','result', config='height=500,width=600,toolbar=no,menubar=yes,scrollbars=yes,resizable=yes,location=no,status=no'); id.document.write(titlenbsp;nbsp;nbsp;Search of rear codonsnbsp;nbsp;nbsp;/titleBODY BGCOLOR='white'); id.focus(); id.document.write(h3Brief results/h3h4Nucleotide sequence/h4brTT); id.document.write(gt; );
IO::Socket and Term::Readline
Hi folks, I am trying to write an tcp server, which listens on a port and provides telnet clients a command line. I love readline, but the readline prompt is getting displayed on the server side not to the client, not to mention the inpossibility to edit the line. does any of you have experience with this? I'm attaching the script, it's short and after running it you can telnet to localhost:8081 Code: use IO::Socket; use Term::ReadLine; # # Server Script: # Copyright 2003 (c) Philip Yuson # this program is distributed according to # the terms of the Perl license # Use at your own risk # $local = IO::Socket::INET-new( Proto = 'tcp', # protocol LocalAddr = 'localhost:8081', # Host and port to listen to # Change the port if 8081 is being used Reuse = 1 ) or die $!; # # Server Script: # Copyright 2003 (c) Philip Yuson # this program is distributed according to # the terms of the Perl license # Use at your own risk # $local = IO::Socket::INET-new( Proto = 'tcp', # protocol LocalAddr = 'localhost:8081', # Host and port to listen to # Change the port if 8081 is being used Reuse = 1 ) or die $!; $local-listen(); # listen $local-autoflush(1); # To send response immediately print At your service. Waiting...\n; my $addr; # Client handle while ($addr = $local-accept() ) { # receive a request print Connected from: , $addr-peerhost(); # Display messages printPort: , $addr-peerport(), \n; my $result; # variable for Result #while ($addr) { # Read all messages from client ## (Assume all valid numbers) #last if m/^end/gi; # if message is 'end' ## then exit loop #print Received: $_; # Print received message #print $addr $_;# Send received message back ## to verify #$result += $_; # Add value to result #} $term = new Term::ReadLine('Simple Perl calc'); $prompt = Enter your arithmetic expression: ; #$OUT = $term-OUT || STDOUT; while ( defined ($_ = $term-readline($prompt)) ) { $res = eval($_), \n; warn $@ if $@; print $OUT $res, \n unless $@; $term-addhistory($_) if /\S/; } chomp; # Remove the CR if (m/^end/gi) {# You need this. Otherwise if # the client terminates abruptly # The server will encounter an # error when it sends the result back # and terminate my $send = result=$result;# Format result message print $addr $send\n; # send the result message print Result: $send\n;# Display sent message } print Closed connection\n;# Inform that connection # to client is closed close $addr;# close client print At your service. Waiting...\n; # Wait again for next request } -- Ernest Beinrohr, OERNii eAdmin @ axonpro.sk, http://www.axonpro.sk/ +421-2--6241-0360, +421-903--482-603 HomePage: http://www.OERNii.sk/ ICQ: 28153343 --- There are 10 kinds of people, those that understand binary, and those that do not -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Nucleotide Sequencing
Sumit Kaur [EMAIL PROTECTED] wrote: : : I am a fresh starter of Perl and I need to write a : script that perform the same function done by the : following JavaScript. I know it is wrong to ask for : code but I am in urgent requirement of this. Please state the nature of the emergency. - If it is homework, read the FAQ - We don't do that. - If it is work, your boss (client) is setting an unrealistic goal. - If you need to hire one of us, check out a perl jobs list. BTW, http://bioperl.org/ has some excellent resources for biologists. HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Nucleotide Sequencing
--As of Wednesday, March 10, 2004 6:29 PM -0600, Charles K. Clarkson is alleged to have said: Sumit Kaur [EMAIL PROTECTED] wrote: : : I am a fresh starter of Perl and I need to write a : script that perform the same function done by the : following JavaScript. I know it is wrong to ask for : code but I am in urgent requirement of this. Please state the nature of the emergency. It can't be too urgent: He's asked the same question several times in the last two weeks. He's also never responded to any answers, or clarified the question. BTW, http://bioperl.org/ has some excellent resources for biologists. He's been pointed there before. At this point, this is a troll. Daniel T. Staal --- This email copyright the author. Unless otherwise noted, you are expressly allowed to retransmit, quote, or otherwise use the contents for non-commercial purposes. This copyright will expire 5 years after the author's death, or in 30 years, whichever is longer, unless such a period is in excess of local copyright law. --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: backreferences
Stuart White wrote: Geez, I can't recall them covering (?: ) in my books...D'oh! The part about it grouping and capturing things makes sense, as it's the cousin of ( ). The part about being able to include the |'s doesn't. I found out, without knowing at the time, that the parentheses breakdown with |'s. I didn't know it at the time, but when I put the ORs in the parentheses and ran the program, I just got the command prompt, no output. Greetings! E:\d_drive\perlStuffperl -w my $string = 'Yada, yuda, heyho, whuzit'; my $regex = '(Y.{3}).*?(y.{3}).*?(boingo|eekers|heyho).*?(\w*)$'; if ($string =~ /$regex/i) { print $1\n$2\n$3\n$4\n; } ^Z Yada yuda heyho whuzit So the problem may lie elsewhere in the match. Joseph -- 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 to make object properties accessible by same-named function
At 01:26 PM 3/10/04 -0700, Wiggins d Anconia wrote: I believe this is handled with Autoloading. Check out the Autoloading section of perldoc perlsub for more. In particular check out the AUTOLOAD method of the AppConfig::State module source: http://search.cpan.org/src/ABW/AppConfig-1.56/lib/AppConfig/State.pm The comments before it discuss it a little. Wow! I'm in love with Perl all over again. Tempered, as usual, by the impure thought that Autoloading is at best minimally descriptive of what is actually happening. Thanks Wiggins and Paul. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Win32::OLE 7 Excel
Now Using Win32::OLE I could input Data into an Excel sheet using the perl docs by ActiveState. However now I also want to format Here is my code snippet $Range = $Sheet-Range(E1); with (my $r = $Sheet-Columns($Range), ColumnWidth = 1); Very simple eh? Any reason why it would not work AND not give any error messages as well. __ Do you Yahoo!? Yahoo! Search - Find what youre looking for faster http://search.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Win32::OLE 7 Excel
change 'with' - 'while' while (my $r = $Sheet-Columns($Range), ColumnWidth = 1); Saadat Saeed [EMAIL PROTECTED] 03/11/2004 11:55 AM To [EMAIL PROTECTED] cc Subject Win32::OLE 7 Excel Now Using Win32::OLE I could input Data into an Excel sheet using the perl docs by ActiveState. However now I also want to format Here is my code snippet $Range = $Sheet-Range(E1); with (my $r = $Sheet-Columns($Range), ColumnWidth = 1); Very simple eh? Any reason why it would not work AND not give any error messages as well. __ Do you Yahoo!? Yahoo! Search - Find what youre looking for faster http://search.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Win32::OLE 7 Excel
Now it gives me an error :-( syntax error at mailrep.pl line 52, near ); Execution of mailrep.pl aborted due to compilation errors. --- Hari Fajri [EMAIL PROTECTED] wrote: change 'with' - 'while' while (my $r = $Sheet-Columns($Range), ColumnWidth = 1); Saadat Saeed [EMAIL PROTECTED] 03/11/2004 11:55 AM To [EMAIL PROTECTED] cc Subject Win32::OLE 7 Excel Now Using Win32::OLE I could input Data into an Excel sheet using the perl docs by ActiveState. However now I also want to format Here is my code snippet $Range = $Sheet-Range(E1); with (my $r = $Sheet-Columns($Range), ColumnWidth = 1); Very simple eh? Any reason why it would not work AND not give any error messages as well. __ Do you Yahoo!? Yahoo! Search - Find what youâre looking for faster http://search.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response __ Do you Yahoo!? Yahoo! Search - Find what youre looking for faster http://search.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response