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

I have a script that outputs file names.. but the names are printed with brackets around them- (filename.txt). I want it to print like this- filename.txt. Not sure which operators to use to remove the brackets when i print the file names. -Lisa.

Replies are listed 'Best First'.
Re: Format Output
by DamnDirtyApe (Curate) on Aug 26, 2002 at 06:47 UTC

    Something like this would probably do for you:

    my @files = ( '(foo.txt)', '(bar.pl)', '(zoot.py)' ) ; my @files_wo_parens = map { /\((.*?)\)/ } @files ; print join ' : ', @files_wo_parens ;

    _______________
    DamnDirtyApe
    Those who know that they are profound strive for clarity. Those who
    would like to seem profound to the crowd strive for obscurity.
                --Friedrich Nietzsche
Re: Format Output
by Zaxo (Archbishop) on Aug 26, 2002 at 06:47 UTC

    My e.s.p. is just terrible today (too much tinfoil), so I'm not sure either.

    How about showing the code that produces your file?

    After Compline,
    Zaxo