At 12:17 PM +0800 3/28/02, allan wrote:
[snip]
>i have a script that traverse all directories from a
>specfied starting point.
>so when i recursively get to a new file i wish to detab that
>file on the fly as if i had supplied the filename as an argument
>
>sub recursion {
> ...
> if (-f $specfile ) {
> # detab code goes here
> }
> ...
> # next file/dir
>}
>
>
>is that possible still using the -i switch?
Yes. Within a script, use $^I.
local $^I = '.bak' # use " = '';" for no backup
local @ARGV = ($file); # put your file(s) here
while <> {
s/pattern/replacement/;
print
}
perlvar(1) has a tidbit. See also Programming Perl (Wall,
Christiansen & Orwant), Chapter 2, section on Special Variables; and
Perl Cookbook (Christiansen & Torkington), Example 7.9.
Enjoy.
1;
--
- Bruce
__bruce_van_allen__santa_cruz_ca__