Re: printing content of found file

2007-06-28 Thread John W. Krahn
Amichai Teumim wrote: Thank you John Why do I need use warnings; use strict; It works without them: with them i get: Global symbol "@list" requires explicit package name at ./obj14-2.pl line 7. Global symbol "$item" requires explicit package name at ./obj14-2.pl line 10. Global symbol "@li

Re: printing content of found file

2007-06-28 Thread Prabu Ayyappan
Hi, Hope you can find your solution from the following two approaches Approach I #!/usr/bin/perl while (<*>) { if ($_ =~ /note/){ open(FH, "$_"); @fcontent = ; print @fcontent; close(FH); } } APPROACH II opendir(CURRENT,"."); @list = readdir(CURRENT); clos

Re: printing content of found file

2007-06-28 Thread Prabu Ayyappan
Hi, Hope you can find your solution from the following two approaches Approach I #!/usr/bin/perl while (<*>) { if ($_ =~ /note/){ open(FH, "$_"); @fcontent = ; print @fcontent; close(FH); } } APPROACH II opendir(CURRENT,"."); @list = readdir(CURRENT); clos

Re: printing content of found file

2007-06-28 Thread Prabu Ayyappan
Hi, Hope you can find your solution from the following two approaches Approach I #!/usr/bin/perl while (<*>) { if ($_ =~ /note/){ open(FH, "$_"); @fcontent = ; print @fcontent; close(FH); } } APPROACH II opendir(CURRENT,"."); @list = readdir(CURRENT); clos

Re: printing content of found file

2007-06-28 Thread John W. Krahn
Amichai Teumim wrote: I'm trying to do the following: I want to search for a specific file/s in my current dir and when it finds it, print its contents. So I did the following: #!/usr/bin/perl The next two lines in your program should be: use warnings; use strict; opendir(CURRENT,".");

Re: printing content of found file

2007-06-28 Thread Jeff Pang
Amichai Teumim 写道: I'm trying to do the following: I want to search for a specific file/s in my current dir and when it finds it, print its contents. So I did the following: #!/usr/bin/perl please add 'use strict' and 'use warnings' at the the begin of a script. opendir(CURRENT,"."); opend

printing content of found file

2007-06-28 Thread Amichai Teumim
I'm trying to do the following: I want to search for a specific file/s in my current dir and when it finds it, print its contents. So I did the following: #!/usr/bin/perl opendir(CURRENT,"."); @list = readdir(CURRENT); closedir(CURRENT); foreach $item (@list){ if($item =~ /notes/){ open(FI