HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- killing script (Perl)
Operating System - HP-UX
1832648
Members
3442
Online
110043
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
02-02-2010 10:31 AM
02-02-2010 10:31 AM
Hi, guys !
I can't understand why my script where I was processing files witn .zip extension using:
...
opendir(DIR, "$dirr");
@files = grep(/\.zip$/,readdir(DIR);
closedir(DIR);
...
stopped working, nothing goes into @files now, I ran simple test script that pasted below and same result, it works with and doesn't with @files, tried Everything I could imagine, and still can' get why -(.
Please help.
Vic
-------------------- my test script
#!/usr/local/bin/perl
$dirr="/home/gemsdev/tidalgems";
print " #1 Opening dir $dirr\n";
opendir (DIRR,$dirr) or die "#1 can't open DIRR $dirr\n";
while ($igot = readdir(DIRR)) {
print "#1 list: $igot\n";
}
closedir(DIRR);
print " #2 Opening dir $dirr\n";
opendir (DIRR,$dirr) or die "#2 can't open DIRR $dirr\n";
@files=readdir(DIR);
print "#2 array: @files\n";
closedir(DIRR);
I can't understand why my script where I was processing files witn .zip extension using:
...
opendir(DIR, "$dirr");
@files = grep(/\.zip$/,readdir(DIR);
closedir(DIR);
...
stopped working, nothing goes into @files now, I ran simple test script that pasted below and same result, it works with
Please help.
Vic
-------------------- my test script
#!/usr/local/bin/perl
$dirr="/home/gemsdev/tidalgems";
print " #1 Opening dir $dirr\n";
opendir (DIRR,$dirr) or die "#1 can't open DIRR $dirr\n";
while ($igot = readdir(DIRR)) {
print "#1 list: $igot\n";
}
closedir(DIRR);
print " #2 Opening dir $dirr\n";
opendir (DIRR,$dirr) or die "#2 can't open DIRR $dirr\n";
@files=readdir(DIR);
print "#2 array: @files\n";
closedir(DIRR);
Solved! Go to Solution.
- Tags:
- Perl
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2010 10:48 AM
02-02-2010 10:48 AM
Solution
Hi Victor:
This works:
#!/usr/bin/perl
use strict;
use warnings;
my $dirr = shift || '.';
opendir(DIR, "$dirr") or die;
my @files = grep( /\.zip$/, readdir(DIR) );
closedir(DIR);
print "'@files'\n";
...at the least, you were missing a ')'.
Regards!
...JRF...
This works:
#!/usr/bin/perl
use strict;
use warnings;
my $dirr = shift || '.';
opendir(DIR, "$dirr") or die;
my @files = grep( /\.zip$/, readdir(DIR) );
closedir(DIR);
print "'@files'\n";
...at the least, you were missing a ')'.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2010 12:11 PM
02-02-2010 12:11 PM
Re: killing script (Perl)
Tx, James
Yes it works, I need to take a break.
Tx again
V
Yes it works, I need to take a break.
Tx again
V
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP