- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Ghost in a PERL script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2005 10:11 PM
04-20-2005 10:11 PM
Ghost in a PERL script
I'm running a simple PERL program which lists a directory content, then analyze each item of the directory, then lists again, and so on.
SOmetimes the lists loopbacks on itself.
See the program branch ...
system("ls -rt $buffer/*.ToBeCopied > $buffer/TBC 2>/dev/null");
if ( -T "$buffer/TBC" && -s "$buffer/TBC" ) {
open (FILE_LIST, "$buffer/TBC");
while (my $filename=
print "process $$: processing $filename\n";
}
...
There's a KSH script which is populating the directory.
It seems that the "$filename=
any helps?
thanks
Enrico
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2005 10:17 PM
04-20-2005 10:17 PM
Re: Ghost in a PERL script
$n1 = 0;
# your code
# Additional while condition
while($n1 eq 0){;
if(eof(FILE_LIST)){ $n1 = 1 } ;
};
This way when you detect eof, end of file in your reading of the file list your program can terminate.
Good Luck,
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2005 10:53 PM
04-20-2005 10:53 PM
Re: Ghost in a PERL script
it seems EOF never detected.......
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2005 05:08 AM
04-21-2005 05:08 AM
Re: Ghost in a PERL script
however, you'd be better off using some of
Perl's built in operators instead of doing
a system("ls ...") and reading in the file:
opendir(DIR, $buffer);
@files = sort(readdir(DIR));
closedir(DIR);
foreach $file (@files) {
$filename = "$buffer/$file";
next unless -T $filename;
next unless -s $filename;
next unless $filename =~ /\.ToBeCopied$/;
print "process $$: processing $filename\n";
...
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2005 05:41 PM
04-21-2005 05:41 PM
Re: Ghost in a PERL script
I have attached sample perl file to list directory recursively.
Please change your $root_dir variable.
Regards
Ganesha Sridhara
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2005 10:18 PM
04-21-2005 10:18 PM