Perl recursive loop symbolic link final destination using Unix readlink command


/ Published in: Perl
Save to your folder(s)

Snippet obtained from Stackoverflow courtesy of [Loki Astari](http://stackoverflow.com/a/130428)


Copy this code and paste it in your HTML
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4.  
  5. while(chomp(my $file = <>))
  6. {
  7. while(-l $file)
  8. {
  9. $file = readlink $file;
  10. }
  11. print "$file\n";
  12. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.