Read Content Of External File with PERL

2007-08-16 Thread vunet . us
Hello, We read the content of external file like this: open(TEXT,"newtext.txt"); print TEXT; close (TEXT); But how to read a file located on another server? Is there a module or hack for it? This wouldn't work, obviously: open(TEXT,"http://vunet.us/contact/index.asp";); print TEXT; close (TEXT);

Re: Find and replace from CSV

2007-08-16 Thread kevc73
Update: Thanks everyone for the help. I ended up using Mug's version. ** #/usr/bin/perl use strict; use warnings; my $csv = 'auth.txt'; # replace your csv file name here open FH, $csv or die "canot open file $csv: $!\n"; for() {

Re: How to open a file in a folder but without knowing its name

2007-08-16 Thread usenet
On Aug 16, 7:13 am, [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote: > I am a beginner in Perl.. That must be why you seen to be unaware of the perldoc command. > I need a perl script to open a file from a specific folder where the > script is. perldoc -f open > Note:That folder will always have

Re: How to open a file in a folder but without knowing its name

2007-08-16 Thread Chas Owens
On 8/16/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Dear All, > > I am a beginner in Perl.. > > I need a perl script to open a file from a specific folder where the > script is. > > Note:That folder will always have one file but with different name and > with same extension. > > I also have

Re: File::Find help

2007-08-16 Thread Chas Owens
On 8/16/07, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: > Paul Lalli wrote: > > So define the subroutine in the same scope as the array. Move the > > subroutine into the if-statement as well. > > Huh? > > Please speak Perl. > > Subroutines are global. Unless they're anonymous. And even then, t

RE: File::Find help

2007-08-16 Thread Dan Sopher
Thanks for everyone's replies. It helped a lot. It ended up like this. My next question is the use of the array reference, @list. Is it bad form? #!/usr/bin/perl -w use strict; use File::Find; if (1) { my $dir = "/var/SAMPLES"; my @list; find ( { wanted=>sub { &found(

Re: How to open a file in a folder but without knowing its name

2007-08-16 Thread Mr. Shawn H. Corey
[EMAIL PROTECTED] wrote: Dear All, I am a beginner in Perl.. I need a perl script to open a file from a specific folder where the script is. Note:That folder will always have one file but with different name and with same extension. I also have to get the name of that file and rename it by a

Re: File::Find help

2007-08-16 Thread Mr. Shawn H. Corey
Paul Lalli wrote: So define the subroutine in the same scope as the array. Move the subroutine into the if-statement as well. Huh? Please speak Perl. Subroutines are global. Unless they're anonymous. And even then, they are. It's just difficult to get a hold on them. -- Just my 0.0

Re: File::Find help

2007-08-16 Thread Mr. Shawn H. Corey
Dan Sopher wrote: Hello. The following code example creates a list of regular files in a directory. Using File::Find, I'm unable to localize an array to hold the list of files. Is there a way to create the list with a localized array? TIA. #!/usr/bin/perl -w ## Create a list of regular files

Re: File::Find help

2007-08-16 Thread Paul Lalli
On Aug 16, 6:45 pm, [EMAIL PROTECTED] (Dan Sopher) wrote: > Hello. The following code example creates a list of regular files in a > directory. Using File::Find, I'm unable to localize an array to hold the > list of files. Is there a way to create the list with a localized array? > TIA. > > #!/usr/

How to open a file in a folder but without knowing its name

2007-08-16 Thread [EMAIL PROTECTED]
Dear All, I am a beginner in Perl.. I need a perl script to open a file from a specific folder where the script is. Note:That folder will always have one file but with different name and with same extension. I also have to get the name of that file and rename it by adding some characters to th

Re: File::Find help

2007-08-16 Thread Chas Owens
On 8/16/07, Dan Sopher <[EMAIL PROTECTED]> wrote: > > > Hello. The following code example creates a list of regular files in a > directory. Using File::Find, I'm unable to localize an array to hold the > list of files. Is there a way to create the list with a localized array? > TIA. > > > > #!/usr/

Re: One liner to change one line

2007-08-16 Thread Chas Owens
On 8/16/07, John W. Krahn <[EMAIL PROTECTED]> wrote: snip > The object created by qr// *is* a compiled regex: snip Yeah my bad, the stringification confused me for a minute. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

File::Find help

2007-08-16 Thread Dan Sopher
Hello. The following code example creates a list of regular files in a directory. Using File::Find, I'm unable to localize an array to hold the list of files. Is there a way to create the list with a localized array? TIA. #!/usr/bin/perl -w ## Create a list of regular files in a directory. us

Re: One liner to change one line

2007-08-16 Thread Gunnar Hjalmarsson
Chas Owens wrote: qr// is just a fancy double quote that adds a non-capturing group and sets the appropriate options (in case you did something like qr/foo/i). The string "(?:-xism:foo)" is no more or less a regex than the string "foo". Let's look into that. C:\home>type test.pl $re1 = '(?i-x

Re: One liner to change one line

2007-08-16 Thread John W. Krahn
Chas Owens wrote: On 8/16/07, Paul Lalli <[EMAIL PROTECTED]> wrote: snip Silly rhetorical-ness aside, you seem unfamiliar with the term you introduced to this thread: "string form of a regexp": $ perl -le' $a = q{foo}; $b = qr{foo}; print $a; print $b; ' foo (?-xism:foo) My assertion is that y

Re: Net:SFTP Configuration

2007-08-16 Thread Chas Owens
On 8/16/07, kilaru rajeev <[EMAIL PROTECTED]> wrote: snip > > Another common problem is that different versions of Unix (and Linux) > > use different implementations of ssh. This isn't a problem for most > > things, but they tend to use different formats for the private and > > public key files.

Re: One liner to change one line

2007-08-16 Thread Chas Owens
On 8/16/07, Paul Lalli <[EMAIL PROTECTED]> wrote: snip > Silly rhetorical-ness aside, you seem unfamiliar with the term you > introduced to this thread: "string form of a regexp": > > $ perl -le' > $a = q{foo}; > $b = qr{foo}; > print $a; > print $b; > ' > foo > (?-xism:foo) > > My assertion is tha

Re: Net:SFTP Configuration

2007-08-16 Thread kilaru rajeev
I had generated the Key pair. I installed the public key on the server. And, while generating the keys I had not passed any *passphrase.* That is why, it is not asking for the password/passphrase while connecting. I guess we need to provide the configuration details in our program while connecting

Re: One liner to change one line

2007-08-16 Thread Paul Lalli
On Aug 16, 10:19 am, [EMAIL PROTECTED] (Chas Owens) wrote: > On 8/16/07, Paul Lalli <[EMAIL PROTECTED]> wrote: > > > On Aug 16, 5:12 am, [EMAIL PROTECTED] (Chas Owens) wrote: > > > Basically > > > it all comes down to this: always use quotemeta unless the variable is > > > known to contain the stri

Re: building Perl 5.8.8

2007-08-16 Thread Chas Owens
On 8/16/07, Robert Hicks <[EMAIL PROTECTED]> wrote: > When it asks about threads should I enable them or no? snip I don't see a reason not to enable ithreads, but you probably don't want (or need) the 5005threads. Note that threading has no effect on your Perl programs unless you specifically wri

Re: One liner to change one line

2007-08-16 Thread Chas Owens
On 8/16/07, Paul Lalli <[EMAIL PROTECTED]> wrote: > On Aug 16, 5:12 am, [EMAIL PROTECTED] (Chas Owens) wrote: > > Basically > > it all comes down to this: always use quotemeta unless the variable is > > known to contain the string form of a regex. > > No. It comes down to: "always use quotemeta un

Re: MP3 tags

2007-08-16 Thread Evyn
Thanks Paul and Tom! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Net:SFTP Configuration

2007-08-16 Thread Chas Owens
On 8/16/07, kilaru rajeev <[EMAIL PROTECTED]> wrote: > Hi Jeff, > > I could able to connect to the remote machine with normall ssh. When I treid > to connect through a perl program it is giving following error. > > *Starting ftp for getting Fund files.Connecting to SFTP Server: tisact.txt > in new

building Perl 5.8.8

2007-08-16 Thread Robert Hicks
When it asks about threads should I enable them or no? Robert -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Format Question

2007-08-16 Thread Chas Owens
On 8/16/07, Mathew Snyder <[EMAIL PROTECTED]> wrote: snip > Would you recommend straight Perl to handle the formatting or is there another > method that can handle this? snip There are many template modules in CPAN that might make your life easier, but in general I stick to printf. -- To unsubsc

Re: Format Question

2007-08-16 Thread Mathew Snyder
Tom Phoenix wrote: > On 8/15/07, Mathew Snyder <[EMAIL PROTECTED]> wrote: > >> How would I go about sub-listing something. For instance, if I have a work >> order that has been worked on during different days, I want to list the work >> order once and each day below it. It would look like this:

Re: Net:SFTP Configuration

2007-08-16 Thread kilaru rajeev
Hi Jeff, I could able to connect to the remote machine with normall ssh. When I treid to connect through a perl program it is giving following error. *Starting ftp for getting Fund files.Connecting to SFTP Server: tisact.txt in new of perl mod .. cfg object :Net::SSH::Perl::Config=HASH(0x10663c):

Re: One liner to change one line

2007-08-16 Thread Paul Lalli
On Aug 16, 5:12 am, [EMAIL PROTECTED] (Chas Owens) wrote: > Basically > it all comes down to this: always use quotemeta unless the variable is > known to contain the string form of a regex. No. It comes down to: "always use quotemeta unless the variable is known to contain the string form of a re

Re: One liner to change one line

2007-08-16 Thread Paul Lalli
On Aug 16, 4:37 am, [EMAIL PROTECTED] (Dr.Ruud) wrote: > Paul Lalli schreef: > > > s/$h1_sec/$mod_sec/; #replace the pattern found with the > > modified version > > Many s/$search/replace/ constructs should have been written with > quotemeta, so that they look like: > > s/\Q${search}/repl

Re: Array modification

2007-08-16 Thread Chas Owens
On 8/16/07, Sayed, Irfan (Irfan) <[EMAIL PROTECTED]> wrote: > Thanks Chas but my req. is little bit different. > > As I said the data in the array will not be fixed so I don't know how > many elements are present in the array. I don't want to just print the > contents of the array but to use the co

RE: Array modification

2007-08-16 Thread Sayed, Irfan (Irfan)
Thanks Chas but my req. is little bit different. As I said the data in the array will not be fixed so I don't know how many elements are present in the array. I don't want to just print the contents of the array but to use the contents of the array. For example if user select 3 option then my pro

Serial port programming in perl

2007-08-16 Thread Saran . j . jegan
Hello, am just started in perl, am in need to access a serial port and read the data s coming from that , i came to see several modules to do this but i dont know which will be easier to use whether Device::SerialPort is worth enough, can any suggest me how to use them ? -- To unsubscribe, e-ma

Re: [OT] Warnings from code when using perl-dbi

2007-08-16 Thread Ow Mun Heng
On Thu, 2007-08-16 at 10:38 +0100, Gary Stainburn wrote: > Hi > > Firstly, for an excelent general perl list, try [EMAIL PROTECTED] It's not > just for beginners. Ah.. Cool.. I'll subscribe there. > > Secondly, it looks like you're trying to access a field that isn't defined, > possibly by r

Re: Array modification

2007-08-16 Thread Chas Owens
On 8/16/07, Sayed, Irfan (Irfan) <[EMAIL PROTECTED]> wrote: > Hi All, > > I have one array which stores some data after executing specific > command. Depends on situation , command has different output at > different time. sometime array may store 4 values or it may store 5 > values. > > Now my req

Re: Array modification

2007-08-16 Thread Xavier Noria
On Aug 16, 2007, at 11:47 AM, Sayed, Irfan (Irfan) wrote: I have one array which stores some data after executing specific command. Depends on situation , command has different output at different time. sometime array may store 4 values or it may store 5 values. Now my req. is that I need to as

Array modification

2007-08-16 Thread Sayed, Irfan (Irfan)
Hi All, I have one array which stores some data after executing specific command. Depends on situation , command has different output at different time. sometime array may store 4 values or it may store 5 values. Now my req. is that I need to assign no. to those values. for example: if arra

Re: [OT] Warnings from code when using perl-dbi

2007-08-16 Thread Gary Stainburn
Hi Firstly, for an excelent general perl list, try [EMAIL PROTECTED] It's not just for beginners. Secondly, it looks like you're trying to access a field that isn't defined, possibly by running off the end of the row. I've re-written (but not tested) the routine slightly more perlified. See

RE: One liner to change one line

2007-08-16 Thread Andrew Curry
Apologies I miss read the original remark. -Original Message- From: Chas Owens [mailto:[EMAIL PROTECTED] Sent: 16 August 2007 10:12 To: Andrew Curry Cc: Dr.Ruud; beginners@perl.org Subject: Re: One liner to change one line On 8/16/07, Andrew Curry <[EMAIL PROTECTED]> wrote: snip >> Many

Re: One liner to change one line

2007-08-16 Thread Chas Owens
On 8/16/07, Andrew Curry <[EMAIL PROTECTED]> wrote: snip >> Many s/$search/replace/ constructs should have been written with quotemeta, >> so that they look like: >> >> s/\Q${search}/replace/ snip > Why? snip given my $search = "file.txt"; What do you want matched? Without the quotemeta it

RE: One liner to change one line

2007-08-16 Thread Andrew Curry
Why? -Original Message- From: Dr.Ruud [mailto:[EMAIL PROTECTED] Sent: 16 August 2007 09:37 To: beginners@perl.org Subject: Re: One liner to change one line Paul Lalli schreef: > s/$h1_sec/$mod_sec/; #replace the pattern found with the > modified version Many s/$search/replace/

Re: One liner to change one line

2007-08-16 Thread Dr.Ruud
Paul Lalli schreef: > s/$h1_sec/$mod_sec/; #replace the pattern found with the > modified version Many s/$search/replace/ constructs should have been written with quotemeta, so that they look like: s/\Q${search}/replace/ -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe,

RE: problem connecting to mysql database

2007-08-16 Thread Andrew Curry
if you have the instant rails and mysql is running then that should be enough, what error are you getting? what is your operating system? how are you installing it? cpan? or using the make file which comes with it? _ From: alok nath [mailto:[EMAIL PROTECTED] Sent: 16 August 2007 09:23 T

Re: problem connecting to mysql database

2007-08-16 Thread alok nath
Hi, May be valid. I am getting superstitious now. Anyway, I have not installed any mysql client.I have simply downloaded InstantRails which has mysql and started the mysql server which is up and running. Can you explain why you need mysql client now ? Regards Alok. - Orig

RE: problem connecting to mysql database

2007-08-16 Thread Andrew Curry
Really stupid question but have you installed the mysql client first on the box? The module needs the libraries here to work, they must also be in you paths (LD_LIBRARY_PATH, PATH) -Original Message- From: Jeff Pang [mailto:[EMAIL PROTECTED] Sent: 16 August 2007 08:53 To: beginners@perl

Re: problem connecting to mysql database

2007-08-16 Thread Jeff Pang
-Original Message- >From: alok nath <[EMAIL PROTECTED]> >Sent: Aug 16, 2007 1:25 PM >To: beginners@perl.org >Subject: problem connecting to mysql database > I have installed the mysql.pm, by doing the following : > - downloaded the DBD-mysql-4.005.tar and copied the contents of lib to >

Re: Net:SFTP Configuration

2007-08-16 Thread Jeff Pang
-Original Message- >From: kilaru rajeev <[EMAIL PROTECTED]> >Sent: Aug 16, 2007 1:28 PM >To: beginners@perl.org >Subject: Net:SFTP Configuration > >Hi All, > >I have installed Net:SFTP on my UNIX (SOLARIS) machine. I have generated the >Public and Private key pair. I have installed the Pu