Im trying to extract some words which is present between two double quotes " "
Im able to extract but the issue is if any double quoted words is preceded by a word , it is also getting displayed
For eg:- In the word :- "perl"monks i need the word Perl to be extracted but "perl"monks is getting displayed.
The snippet is given below:-
use strict;
open FILE, "<searchfile.txt";
my @line = <FILE>;
for (@line)
{
if ($_ =~ m{["](.*?)["]})
{
print "$_\n";
}
}
P.S:- I dont know whether the below scenario is possible but please give suggestions and ideas:-
When Im extracting a string for eg perl in the above scenario the total no of letters is 4
similarly i want to extract only 4 letters (alphanumeric) in the complete text. Thanks Monks!!!!!!!!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.