Anurag Saran
Anurag Saran

Reputation: 301

Using wildcard characters while running system command in Perl Script

How can we use wildcard characters while running system command in Perl Script. For example using *.src to edit a file with sed - something like :

system("sed -i -e 's/foo/bar/g'  $baseDirPath/*.src");

It gives an error: sed: can't read /home/test/*.src: Not a Directory

Here, $baseDirPath is initialized to /home/test

Upvotes: 0

Views: 581

Answers (1)

user4763550
user4763550

Reputation: 121

Try to chomp the variable $baseDirPath before using it, As the line you have written should just work.

Upvotes: 1

Related Questions