Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I have files with .conv extension . How can i delete those files using unlink? Usually i m doing unlink($filetobedeleted). But how to delete all the files with .conv extension. Thanks.

Replies are listed 'Best First'.
Re: Deleting files with .conv extension
by roboticus (Chancellor) on Dec 31, 2012 at 07:30 UTC
Re: Deleting files with .conv extension
by tobyink (Canon) on Dec 31, 2012 at 15:50 UTC
    unlink for <*.conv>;
    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
Re: Deleting files with .conv extension
by Anonymous Monk on Dec 31, 2012 at 07:30 UTC

    #!/usr/bin/perl --
    use strict; use warnings;
    use autodie;
    use File::Find::Rule;
    my @conv = find( file => name => qr{\.conv$} => in => $startdir );
    for my $file ( @conv ){ eval { unlink($file) } or warn $@ }