Hi all. Is there any efficient way to sort arrays ignoring square brackets and/or other characters? Suppose you have:
@names = ('[Ca]rl', 'Bil[l]y', 'Alan');
I want the output of sort @names be: Alan Bil[l]y [Ca]rl. The standard sort outputs [Ca]rl Alan Bil[l]y beacuse square brackets come...
Hi all. I want to extract words from a text file using regular expression, working line by line, and giving them a line number. Here is my code:
#!/usr/local/bin/perl
$line = "line1. to be or not to be, that is the question";
@wordsinline = split(/\s+/, $line);
foreach $word (@wordsinline){...
Hi there,
I'm new to perl. I wrote a script to split two pieces of poetry into words, but something wrong happen. Here is the .txt file to be processed:
Text 1.
line 1. Tiger, Tiger, burning bright
line 2. in the forest of the night
Text 2.
line 1. To be, or not to be
line 2. that is the...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.