Re: How to reinvent grep in perl?

2007-10-04 Thread Jonathan Lang
siegfried wrote: > Thanks, but if I am piping from stdin to stdout I see two problems: > > (1) how do I implement the -n flags that tell me the line number and > file name where the matches are Well, as long as you're only piping one file at a time, the line number part isn't a problem; but I see

RE: How to reinvent grep in perl?

2007-10-04 Thread siegfried
> >siegfried wrote: >> I need to search large amounts of source code and grep is not doing the job. >> The problem is that I keep matching stuff in the comments of the >> C++/Java/Perl/Groovy/Javascript source code. >> >> Can someone give me some hints on where I might start on rewriting grep in >>

Re: back slash problem

2007-10-04 Thread Paul Lalli
On Oct 4, 8:19 am, [EMAIL PROTECTED] (Praveena Vittal) wrote: > I need a way to replace a backslash(ie:\) with \\ in a string. > > Please help me... $string =~ s{\\}{}g; The problem is that \ is a special character both to a regular expression and to a double quoted string, so it needs to b

Re: back slash problem

2007-10-04 Thread Jeff Pang
2007/10/4, Praveena Vittal <[EMAIL PROTECTED]>: > Hi All, > > I need a way to replace a backslash(ie:\) with \\ in a string. > Hi, See this test, $ perl -e ' > $str = "/usr/local/bin"; > $str =~ s|/|//|g; > print $str' //usr//local//bin Good luck! -- To unsubscribe, e-mail: [EMAIL PROTECTED

Re: Problem with little ftpscript

2007-10-04 Thread Jeff Pang
Hi, I mean you should use Net::FTP rather than NET::FTP. the package name is sensitive for capital letters. 2007/10/4, Ruprecht Helms <[EMAIL PROTECTED]>: > Hi Jeff > >> Can't locate object method "new" via package "NET::FTP" (perhaps you > >> forgot to load "NET::FTP"?) at ./auftraege_holen.pl l

back slash problem

2007-10-04 Thread Praveena Vittal
Hi All, I need a way to replace a backslash(ie:\) with \\ in a string. Please help me... eg:ssh\[[\d]*\] from [\d\.]* consider the string Regards, Praveena -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Problem with little ftpscript

2007-10-04 Thread Ruprecht Helms
Hi Jeff >> Can't locate object method "new" via package "NET::FTP" (perhaps you >> forgot to load "NET::FTP"?) at ./auftraege_holen.pl line 7. >> > > Hi, > > The correct package name is Net::FTP,see this module on cpan: > http://search.cpan.org/~gbarr/libnet-1.22/Net/FTP.pm > I just reinstalled

Re: Problem with little ftpscript

2007-10-04 Thread Jeff Pang
2007/10/4, Ruprecht Helms <[EMAIL PROTECTED]>: > > Can't locate object method "new" via package "NET::FTP" (perhaps you > forgot to load "NET::FTP"?) at ./auftraege_holen.pl line 7. > Hi, The correct package name is Net::FTP,see this module on cpan: http://search.cpan.org/~gbarr/libnet-1.22/Net/

RE: fileOperations using perl

2007-10-04 Thread Siva Prasad
Hi Jeff, This works thanks a lot. Regards, PP. -Original Message- From: Jeff Pang [mailto:[EMAIL PROTECTED] Sent: Thursday, October 04, 2007 1:39 PM To: Siva Prasad Cc: beginners@perl.org Subject: Re: fileOperations using perl 2007/10/4, Siva Prasad <[EMAIL PROTECTED]>: > Can somebod

Re: Problem with little ftpscript

2007-10-04 Thread Jeff Pang
2007/10/4, Ruprecht Helms <[EMAIL PROTECTED]>: > Hi, > > I get an errormessage that the global symbol ftp requires explicit > package name. This is my little script: > > #!/usr/bin/perl > > use strict; > use warnings; > > use Net::FTP; > $ftp = NET::FTP->new(""); > $ftp->login("",""); > $ftp->cwd("

Problem with little ftpscript

2007-10-04 Thread Ruprecht Helms
Hi, I get an errormessage that the global symbol ftp requires explicit package name. This is my little script: #!/usr/bin/perl use strict; use warnings; use Net::FTP; $ftp = NET::FTP->new(""); $ftp->login("",""); $ftp->cwd("/html"); $ftp->get("wir_neu.html"); What have I todo? Regards, Rupr

Re: fileOperations using perl

2007-10-04 Thread Jeff Pang
2007/10/4, Siva Prasad <[EMAIL PROTECTED]>: > Can somebody help me in understanding where am I going wrong and the correct > way of doing the same. > Hi, Hope the codes below explain what you asked. $ cat FileOperations.pm package FileOperations; use strict; use warnings; use File::Slurp qw (re

fileOperations using perl

2007-10-04 Thread Siva Prasad
Hi Gurus, I am trying to do (read/write/append) operations on file using oops in perl. But I am getting the following error Bareword "FileOperations" not allowed while "strict subs" in use at readwriteapp end.pl line 14. BEGIN not safe after errors--compilation aborted at readwr