RE: getting array index inside for loop

2004-04-13 Thread Charles K. Clarkson
Andrew Gaffney <[EMAIL PROTECTED]> wrote: : : I have code that uses a 'foreach(@array) {}' to loop : through an array. I now need to be able to get the : array index inside of that. I know I could switch to : a 'for($loopvar=0;$loopvar<@array;$loopvar++) {}' to : do that, but I'd have to change so

getting array index inside for loop

2004-04-13 Thread Andrew Gaffney
I have code that uses a 'foreach(@array) {}' to loop through an array. I now need to be able to get the array index inside of that. I know I could switch to a 'for($loopvar=0;$loopvar<@array;$loopvar++) {}' to do that, but I'd have to change some other code also. If not that way, is there a way

Re: using WWW::Mechanize

2004-04-13 Thread Randy W. Sims
On 4/11/2004 5:25 PM, Rob Dixon wrote: Randy W. Sims wrote: The following code connects to a linksys router and resets the connection. I can't seem to find the proper way to access the contents of the HTML::Form::InputText object without accessing it's internal data structure. This is part of the

Re: cleaning up references properly

2004-04-13 Thread JupiterHost.Net
Yes it is a bit confusing :) hence all the tension..., my fault I apologize The original idea was this: I have a few items, $foo, @bar, %baz, and FH (via open()) I could (and yes, probably should ;p ) do: undef $foo; undef @bar; undef %baz; close FH; What I'd like to do is accomplish tha

Re: cleaning up references properly

2004-04-13 Thread david
Wiggins D Anconia wrote: >> Jupiterhost.Net wrote: >> >> > >> >> Ok, well you think that might have helped to state in the first place, >> >> especially when posting to a beginners list? >> > >> > Sorry I didn't mean to offend anyone, I felt it was irrelevant to the >> > question. (IE - How do I

Re: cleaning up references properly

2004-04-13 Thread david
Jupiterhost.Net wrote: > > #!/usr/bin/perl > > use strict; > use warnings; > > my $howdy = 'hello'; > push(@ref_to_destroy, \$howdy); > for(@refs_to_destroy) { >my $r = ref($_); > if(defined $r) { >close $_ if $r eq 'IO'; >undef $_ if $r eq 'SCALAR'; > } > } > print

Re: cleaning up references properly

2004-04-13 Thread Wiggins d Anconia
> Jupiterhost.Net wrote: > > > > >> Ok, well you think that might have helped to state in the first place, > >> especially when posting to a beginners list? > > > > Sorry I didn't mean to offend anyone, I felt it was irrelevant to the > > question. (IE - How do I vacuum my car instead of How woul

Re: cleaning up references properly

2004-04-13 Thread JupiterHost.Net
david wrote: Jupiterhost.Net wrote: Ok, well you think that might have helped to state in the first place, especially when posting to a beginners list? Sorry I didn't mean to offend anyone, I felt it was irrelevant to the question. (IE - How do I vacuum my car instead of How would I vacuum a blu

Re: New to perl ...

2004-04-13 Thread Wiggins d Anconia
> > Hello, > > I would like to swap the file name only and not the extension or the > content. > > Example: > There are two file : 1.jpg and 3.jpg > output = 1.jpg becomes 3.jpg and 3.jpg becomes 1.jpg > > OR > > 1.jpg and 3.gif > output = 1.jpg becomes 3.jpg and 3.gif becomes 1.gif > her

RE: New to perl ...

2004-04-13 Thread Jayakumar Rajagopal
Hello, I am not sure, why you want to 'do Nothing' about the contents of the file. if you change gif to jpg, it will conflict the formats. Try this for just changing names: $a='1.x.jpg'; # first file.. $b='3.gif'; # second file.. if ( "$a:$b" =~ /(.*)\.([^\.]+):(.*)\.([^\.]+)/) {

RE: New to perl ...

2004-04-13 Thread Bajaria, Praful
My code is kind of not efficient. Here is the code. where index is 1.jpg or 1.gif. The program only knows "1" if ($image_found == 1) { if ( -e "$index.jpg" ) { $old = 1; system("/bin/mv -f $working_dir/$index.jpg $working_dir/$index_$index.jpg"); $new_file = "$index_$index". "

Re: New to perl ...

2004-04-13 Thread LoneWolf
What you are seeking to do is essentially this: move the first file to a temp file: mv file1.ext /tmp/file1.ext move the second file to the first file: mv file2.ext file1.ext move the temp file to the second file: mv /tmp/file1.ext file2.ext You can do this with a system call for each of the move

Re: New to perl ...

2004-04-13 Thread u235sentinel
What have you tried? Please post the code so we can help Bajaria, Praful wrote: Hello, I would like to swap the file name only and not the extension or the content. Example: There are two file : 1.jpg and 3.jpg output = 1.jpg becomes 3.jpg and 3.jpg becomes 1.jpg OR 1.jpg and 3.gif outpu

New to perl ...

2004-04-13 Thread Bajaria, Praful
Hello, I would like to swap the file name only and not the extension or the content. Example: There are two file : 1.jpg and 3.jpg output = 1.jpg becomes 3.jpg and 3.jpg becomes 1.jpg OR 1.jpg and 3.gif output = 1.jpg becomes 3.jpg and 3.gif becomes 1.gif here we are changing the name only a

Question about dbm

2004-04-13 Thread Prashant Kumar
Hi Peeps, A quickie question about dbms. Is it ok if multiple scripts update the same dbm file? I mean they cannot update the same record at the same time. What I've done is I've implemented a record based locking i.e create a empty file bu the record name. If the file exists then don't modify t

Re: problem about compiler

2004-04-13 Thread david
Pagoda wrote: > problem about compiler > > Below is the code: > #! /usr/bin/perl > use Cwd qw/cwd abs_path/; > print cwd, "\n"; > > I compiled my code: > $perlcc -o hello hello.pl > i compiled the above without any problem > the following infor were printed to stdout: > Note (probably harmles

Re: cleaning up references properly

2004-04-13 Thread david
Jupiterhost.Net wrote: > >> Ok, well you think that might have helped to state in the first place, >> especially when posting to a beginners list? > > Sorry I didn't mean to offend anyone, I felt it was irrelevant to the > question. (IE - How do I vacuum my car instead of How would I vacuum a > b

Re: cleaning up references properly

2004-04-13 Thread JupiterHost.Net
Very cool! Ok, well you think that might have helped to state in the first place, especially when posting to a beginners list? Sorry I didn't mean to offend anyone, I felt it was irrelevant to the question. (IE - How do I vacuum my car instead of How would I vacuum a blue car?) I simply was t

Re: Avoiding using temporary files

2004-04-13 Thread Daniel Staal
--As of Tuesday, April 13, 2004 2:16 PM +0200, Jenda Krynicky is alleged to have said: I am running some substitutions on a file which has a distinctive record structure. Each record is printed to the output filehandle in turn after the substitutions have been performed. Once all records are prin

RE: Where do you put your modules?

2004-04-13 Thread Bob Showalter
Kevin Old wrote: > Hello everyone, > > I've written several subroutines that are useful to me, but not useful > enough to package into separate modules and publish on CPAN. I put > them in a module call KOBagOTrix.pm and just use a "use lib" > statement to point to that module on my hard drive. >

RE: installing perl module without root permission

2004-04-13 Thread Bob Showalter
gohaku wrote: > On Apr 9, 2004, at 6:27 AM, Randal L. Schwartz wrote: > > > Yes, and the instructions are included with your copy of Perl, > > in "perldoc perlmodinstall". > > What if perldoc is not included for some reason? perldoc may be installed, but not in your PATH. Perl comes with a numbe

Re: Avoiding using temporary files

2004-04-13 Thread Jenda Krynicky
From: "Barrett-Small, Richard" <[EMAIL PROTECTED]> > I'm looking for a way to print to a temporary filehandle or something > without having to open a file to print to. You can use IO::String or IO::stringy to create a filehandle that points to a string, not to a file. (I believe IO::String is par

Re: problem about compiler

2004-04-13 Thread Jenda Krynicky
From: "pagoda" <[EMAIL PROTECTED]> > problem about compiler > > Below is the code: > #! /usr/bin/perl > use Cwd qw/cwd abs_path/; > print cwd, "\n"; > > I compiled my code: > $perlcc -o hello hello.pl > > the following infor were printed to stdout: > Note (probably harmless): No library found fo

Re: Connect to a MS-SQL-Server

2004-04-13 Thread Jenda Krynicky
From: "Yue Chi" <[EMAIL PROTECTED]> > how can I connect to a MS-SQL-Server? See the DBI and DBD::ODBC modules. Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry

Re: problem about compiler

2004-04-13 Thread zatoichi
Pagoda wrote: > problem about compiler > > Below is the code: > #! /usr/bin/perl > use Cwd qw/cwd abs_path/; > print cwd, "\n"; > > I compiled my code: > $perlcc -o hello hello.pl > > the following infor were printed to stdout: > Note (probably harmless): No library found for -lposix > pccslkmZ

Connect to a MS-SQL-Server

2004-04-13 Thread Yue Chi
Hello, how can I connect to a MS-SQL-Server? Thank you! Yue -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Spliting some path

2004-04-13 Thread Chris Charley
- Original Message - From: <[EMAIL PROTECTED]> Newsgroups: perl.beginners To: <[EMAIL PROTECTED]> Sent: Saturday, April 10, 2004 12:56 PM Subject: Spliting some path > How can I split some path to directories > for example if my $path is "/home/ftp/some/file" > how can I get elements /h

Re: Unique Dir Listing

2004-04-13 Thread Ben Crane
Japhy, Thank you! But now I have another problem as a result: #!/perl/bin -w use strict; use File::Find; open (DEST, ">c:/temp/dirlist.txt") || die "opening log file: $!"; sub getlist { print DEST "$File::Find::name\n" if -d; print "$File::Find::name\n" if -d; } find \&getlist, 's:/';

Avoiding using temporary files

2004-04-13 Thread Barrett-Small, Richard
Dear all, First post to this list! Hope I do it right! I'm looking for a way to print to a temporary filehandle or something without having to open a file to print to. I am running some substitutions on a file which has a distinctive record structure. Each record is printed to the output filehan