Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Perl] Regex innerhalb File::Find-sub

Empfohlene Antworten

Heyho zusammen,

nun reicht es wohl nicht mehr stiller Mitleser zu sein, da mir folgendes Problem nur noch Kopfzerbrechen bereitet.. Wahrscheinlich ohnehin nur ne Kleinigkeit :rolleyes:

Zu meinem Problem:

Ich will mit Hilfe von File::Find sämtliche Unterverzeichnisse eines ordners nach "ccdb_config.pl" auslesen. Ein Unterverzeichnis heißt immer "_default" und die restlichen sind durchnummeriert. In jedem Ordner befindet sich ein config file, wobei das im "_default" Ordner keine Rolle spielt.

Das war mein Ansatz:

#!usr/bin/perl

use strict;
use File::Find;

require "xxxxxx.pl";
require "xx.pl";


my $path = "/../../../../../";
my $file = "ccdb_config.pl";

sub match {print $File::Find::name."\n" if /$file/gi}

find {wanted => \&match, no_chdir => 0}, $path;[/PHP]

Das Problem ist folgendes Ergebnis:

/../../../../../_default/ccdb_config.pl

/../../../../../2/ccdb_config.pl

/../../../../../2/ccdb_config.pl.tmpl

/../../../../../2/ccdb_config.pl.new

/../../../../../2/ccdb_config.pl.bak20090209

/../../../../../2/ccdb_config.pl.new~

/../../../../../3/ccdb_config.pl

Also habe ich my $file = "ccdb_config.pl"; verändert zu $file = "ccdb_config\.pl[^.*]", um nur noch

/../../../../../_default/ccdb_config.pl

/../../../../../2/ccdb_config.pl

/../../../../../3/ccdb_config.pl

ausgegeben zu bekommen..

Danach erfolgt allerdings keine Ausgabe mehr.. Überprüft habe ich den RegEx mit RegExr

Sofern ich mich denn verstädnlich ausgedrückt habe, wäre es nett, wenn ihr mich an euren Ideen teilhaben lassen könntet :)

LG

Chrisok

Aufruf angepasst und alles ist in Ordnung..

File::Find::find(\&match, $path);

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Konto

Navigation

Suchen

Suchen

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.