Re: Retrieve data via DBI and write into a file

2008-11-07 Thread Rob Dixon
Lauri Nikkinen wrote: Hi Lauri. The critical part of your program is this. > my $outfile = '>temp.txt'; > open(OUTFILE, $outfile) or die "Unable to open $outfile: $!"; I think you're using a Windows platform where a filename like that is invalid. (If you are on Unix and have called a file'>temp

Re: please explain the anonymous sub usage in one of the article from stonehenge in detail for me

2008-11-07 Thread Richard Lee
Jenda Krynicky wrote: If we name the subroutine the code would look like this: sub read_from_stdin { return ; } ... $next = non_blank(\&read_from_stdin); that is again the non_blank() would receive a reference to a subroutine that reads one line from STDIN whenever called. (actually this is

Re: please explain the anonymous sub usage in one of the article from stonehenge in detail for me

2008-11-07 Thread Jenda Krynicky
From: Richard Lee <[EMAIL PROTECTED]> > http://www.stonehenge.com/merlyn/UnixReview/col08.html > > From above article, I am not fully understanding what's going on on > below code. > > 1)is there any difference in $next = $non_blank() and > $next=$non_blank( sub{ }) in terms of funcaitonalit

Re: Regex path

2008-11-07 Thread Mr. Shawn H. Corey
On Fri, 2008-11-07 at 05:55 -0800, Jeff P. wrote: > --- On Fri, 11/7/08, Brent Clark <[EMAIL PROTECTED]> wrote: > > > From: Brent Clark <[EMAIL PROTECTED]> > > Subject: Regex path > > To: beginners@perl.org > > Date: Friday, November 7, 2008, 1:46 PM > > Hiya > > > > I have some paths like so. >

please explain the anonymous sub usage in one of the article from stonehenge in detail for me

2008-11-07 Thread Richard Lee
http://www.stonehenge.com/merlyn/UnixReview/col08.html From above article, I am not fully understanding what's going on on below code. 1)is there any difference in $next = $non_blank() and $next=$non_blank( sub{ }) in terms of funcaitonality? I am not fully understanding the difference in

Re: Regex path

2008-11-07 Thread Brent Clark
Jeff P. wrote: use File::Basename; my $path = dirname("/home/brent/cgi-bin/scripts/common/ticktaktoe"); my ($var) = $path =~ /.*\/(.+)$/; Thank You Worked like a bomb. Regards Brent Clark -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://

Re: Regex path

2008-11-07 Thread Jeff P.
--- On Fri, 11/7/08, Brent Clark <[EMAIL PROTECTED]> wrote: > From: Brent Clark <[EMAIL PROTECTED]> > Subject: Regex path > To: beginners@perl.org > Date: Friday, November 7, 2008, 1:46 PM > Hiya > > I have some paths like so. > > /home/brent/cgi-bin/scripts/common/ticktaktoe > /home/brent/cgi-

Regex path

2008-11-07 Thread Brent Clark
Hiya I have some paths like so. /home/brent/cgi-bin/scripts/common/ticktaktoe /home/brent/cgi-bin/scripts/agent/ticktaktoe This is my regex. ($q) = $ht_file =~ /^(.*)\/[^\/]+/; Im trying to get $q to be populated with common or agent. If anyone can help, it would be appreciated. Regards Bre

Re: Retrieve data via DBI and write into a file

2008-11-07 Thread Jeff P.
--- On Fri, 11/7/08, Lauri Nikkinen <[EMAIL PROTECTED]> wrote: > From: Lauri Nikkinen <[EMAIL PROTECTED]> > Subject: Re: Retrieve data via DBI and write into a file > To: [EMAIL PROTECTED] > Cc: beginners@perl.org > Date: Friday, November 7, 2008, 9:33 AM > Thank you for your reply. Using the c

Re: Retrieve data via DBI and write into a file

2008-11-07 Thread Lauri Nikkinen
Thank you for your reply. Using the code below I get an error message: Global symbol "$var1" requires explicit package name at myscript.pl lin 29. #!/bin/perl use warnings; use strict; use DBI; my $dbs = "dbi:ODBC:DRIVER={servername};SERVER={serverip}"; my ($username, $password) = ('username', '

Re: Retrieve data via DBI and write into a file

2008-11-07 Thread Jeff P.
--- On Fri, 11/7/08, Lauri Nikkinen <[EMAIL PROTECTED]> wrote: > From: Lauri Nikkinen <[EMAIL PROTECTED]> > Subject: Retrieve data via DBI and write into a file > To: beginners@perl.org > Date: Friday, November 7, 2008, 8:28 AM > > my $outfile = '>temp.txt'; # ">" is not a part of the regula

Retrieve data via DBI and write into a file

2008-11-07 Thread Lauri Nikkinen
Hello, First post to this forum. I'm trying to retrieve data via DBI and write it into a text file. Everything works fine with DBI but I don't know how to write query results into my text file. My code is here: ## #!/bin/perl use warnings; use strict; use DBI; my $dbs =