Zentara wrote: > > Hi, Hello,
> I'm trying to find all .so.xxx files on my system. > Eventually I want to do things with them, but for > now I just want to identify them. > > I pretty much have it, except I'm lacking enough > regex knowledge to separate out the so from the .so. > files. > > I'm matching > > cursor > moc_sound > libqt.so.2 > libqt-mt.so > etc. > > ########################################## > #!/usr/bin/perl -w > use strict; > use File::Basename; > use File::Find; > my $name; > my $dirname= '/usr/lib'; > > find (\&found, $dirname); > > sub found { > ($name) = basename("$File::Find::name"); There is really no point in using basename() like this because File::Find provides the file name. perldoc File::Find [snip] The wanted() function does whatever verifications you want. `$File::Find::dir' contains the current directory name, and `$_' the current filename within that directory. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `$File::Find::name' contains the complete pathname to the file. You are chdir()'d to `$File::Find::dir' when the function is called, unless `no_chdir' was specified. When > if ($name =~ m/.so/){ > print $name,"\n"; > }} > ########################################## #!/usr/bin/perl -w use strict; use File::Find; my $dirname = '/usr/lib'; find( \&found, $dirname ); sub found { print "$_\n" if /\.so\./; # or maybe # print "$_\n" if /\.so\.[^.]+$/; } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]