Changing the extension of a .txt file to .pl file

Posted on 2009-05-08
Last Modified: 2012-05-06
I am having a an array like
i want to convert the extension of these files to .pl

I did like
foreach  @array
tr /.*.tx/.*.p/;
print $_."\n";

But it is printing like
How can i print like,,
Question by:ashok1312
LVL 39

Accepted Solution

abel earned 250 total points
ID: 24334462
the tr command replaces each letter of its first argument with the corresponding letter in the replacement string. It is not a regular expression. I think what you are after was this:

LVL 84

Expert Comment

ID: 24334483
foreach(  @array )
print $_."\n";

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
pattern problem 9 84
Greater than or equal to 2005? 3 52
regx  exclude  pattern 6 48
Regular Expression 1-100 with two digits 15 60
Do you hate spam? I do, and I am willing to bet you do as well. I often wonder, though, "if people hate spam so much, why do they still post their email addresses on the web?" I'm not talking about a plain-text posting here. I am referring to the fa…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (,  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question