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...
Thanks for your answer Spookie. Well I just want that the script recognizes the presence of line notation, and when that is not present it should output an error. I don't need something like:
I want
Perhaps I should use some other command, but by now my knowledge of perl is unfortunately...
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){...
Great! Thank you for your help. Now I'm going to work to the second part of my project, that is a script that makes a text index. Something like this:
INDEX
be 2, 1
bright 1, 1
burning 1, 1
forest 1, 2
in 1, 2
is 2, 2
night 1, 2
not 2, 1
of 1, 2
or 2, 1
question 2, 2
that 2, 2
the 1, 2; 2, 2...
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.