Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: separating two sententences

by Anonymous Monk
on Sep 16, 2011 at 03:54 UTC ( #926297=note: print w/ replies, xml ) Need Help??


in reply to Re: separating two sententences
in thread separating two sententences

thank you for your paying attention .i want to create an excel file that shows emails in one column and name in another column.

17nolasvegasnv@fitness19.com 117nolasvegasnv 15tofit@comcast.net Patrea 1800noda@gmail.com 1800noda 188rivervalenj@fitness19.com 188rivervalenj 199pittsburghpa@fitness19.com 199pittsburghpa 1advocare@msn.com 1advocare" 1mbabic@gmail.com Milos


Comment on Re^2: separating two sententences
Download Code
Re^3: separating two sententences
by dreadpiratepeter (Priest) on Sep 16, 2011 at 04:14 UTC
    and you still have not told us what is not working. What happens when you run it? I spend all day with a QA department that thinks "doesn't work" is a legitimate bug report. I don't need it on the monks too ;)


    -pete
    "Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."

      i am totally confused with regex here.it doesnt recognize the word after ; and between " " and another question is email address.some of them start with numbers and some with alphabet.oooooooooh!!

        even though you STILL haven't told me what your error is, I'll try to help. Here is a different approach:
        while(<IN>) { chomp; my ($email,$name) = split /;/; $name =~ s/\"//g; print $email . ',' . $name . "\n"; }


        -pete
        "Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."
Re^3: separating two sententences
by AnomalousMonk (Abbot) on Sep 16, 2011 at 04:34 UTC
    i want to create an excel file ...

    This tells us your ultimate goal, but does not describe what you expect the code of the OP to do and just what is going wrong. dreadpiratepeter was trying to get details of this kind.

    It seems that the OP code is a first attempt at reading the contents of a file and processing and printing the contents. This is a good first step to your final goal. As it stands, I can make a guess at what is happening. The regex  /("/w+/")/ has extraneous / (forward slash) characters in it that are interpreted as premature terminations of the regex (see muba's analysis below). Try something like this (untested):

    use warnings; use strict; my $filename = 'myfile'; open my $fh, '<', $filename or die "opening '$filename': $!"; while (<$fh>) { if (m{ ("\w+") }xms) { print "$1 \n"; } } close $fh;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://926297]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2014-12-27 19:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls