Current location: Hot Scripts Forums » Programming Languages » Perl » Cannot user wildcard in Perl under windows XP


Cannot user wildcard in Perl under windows XP

Reply
  #1 (permalink)  
Old 01-23-05, 10:17 AM
bruceleung2000 bruceleung2000 is offline
New Member
 
Join Date: Mar 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Cannot user wildcard in Perl under windows XP

Hello,
I have written a program to try to get wildcard from DOS command (under Windows XP), but it cannot do wildcard to get all files (ok1, ok2, .... ok9) but ok* or ok? - it WORKS under only unix and linux.
Does anybody help to tell me how to solve this problem ???

Thanks in advance !!!
Regards,
Bruce

------------------ command under DOS prompt ----
e.g. perl rm-alike.pl ok*
-------------- end ----------

------------ extract from rm-alike.pl ------------
while ($fname = $ARGV[$ctr]) {
print "ctr=[" ;
print $ctr ;
print "]\n" ;
print "fname=[" ;
print $fname ;
print "]\n" ;
$fname_arr[$ctr] = $fname;
print "fname_arr=[" ;
print $fname_arr[$ctr];
print "]\n" ;
$ctr = $ctr +1;
} # end while
---------------- end --------------------------------

----------------- output ---------------------
G:\Schedule_Jobs\perl>perl rm-alike.pl 'ok*'
ctr=[0]
fname=['ok*']
---------------- end -------------------


----------------- Version of my Perl -----
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

G:\Schedule_Jobs\perl>perl -v

This is perl, v5.8.6 built for MSWin32-x86-multi-thread
(with 3 registered patches, see perl -V for more detail)

Binary build 811 provided by ActiveState Corp. http://www.ActiveState.com
ActiveState is a division of Sophos.
Built Dec 13 2004 09:52:01
------------- end -------------------------
Reply With Quote
  #2 (permalink)  
Old 01-23-05, 12:17 PM
Chas Chas is offline
Coding Addict
 
Join Date: Oct 2003
Location: California
Posts: 359
Thanks: 0
Thanked 0 Times in 0 Posts
How about useing the built in file globbing?

Code:
perl -e "print join($/, <ok*>)"
from the command line or in a script:

Code:
my $glob = $ARGV[...]
while (<$glob>) {
  ...
}
~Charlie
Reply With Quote
  #3 (permalink)  
Old 01-23-05, 01:12 PM
Chas Chas is offline
Coding Addict
 
Join Date: Oct 2003
Location: California
Posts: 359
Thanks: 0
Thanked 0 Times in 0 Posts
Here's a bit of info on I/O operators and globbing:

http://www.perldoc.com/perl5.8.4/pod...#I-O-Operators

~Charlie
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with my largest perl script. Grabbing data from a file. Sunnmann Perl 2 04-23-08 03:27 AM
2 flash websites for sale metamorph General Advertisements 5 01-09-05 10:03 PM
Windows XP Home & PHP Sessions jpthomas82 PHP 2 12-10-04 12:22 AM
Several questions for PHP and MySql starting in Windows XP artaco2000 PHP 4 10-14-04 12:25 PM
Need Epinions-lite system in PHP & MYSQL wali001 Job Offers & Assistance 4 01-12-04 06:02 AM


All times are GMT -5. The time now is 04:02 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.