#!/usr/bin/perl foreach ( @ARGV ) { if ( -l ) { if ( -f ) { $Real = readlink; unlink; `cp $Real $_`; unless ( $? ) { $Mode = (stat( $_ ))[2]; chmod( ($Mode | 0200) , $_ ); } else { warn "??? $?\n"; } } else { warn "'$_' does not represent a file:\n\t$Real\n"; } } else { warn "'$_' is not a link.\n"; } }