Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

I don't mean 'fix it' in general, as I'm sure there are plenty of people with that request. Specifically I'm looking for help with the interpreter becoming upset with $userhash{$currow[0]}{$domain[$i]} = 1;, and $userhash{$currow[0]}{$domain[$i]} = "undef"; and I'm getting the warning 'requires explicit package name', though that should be within the scope of that variable's declaration, right? Thoughts? Advice? Rants?

#!/usr/bin/perl use strict; use warnings; print "What is the name of the access rights .csv? (Full file name)\n" +; my $file = <>; print "Is there a header in this file?\n"; my $header = <>; if ($header =~ m/^yes|^y]/i){ $header = "1"; } else {$header = "undef"; } print "What file format are your messages in?\n"; my $format = <>; open (CSV, "<", $file); my (@emailList, @domain, %userHash); while (my $currow = <CSV>){ if ($header || $currow =~ m/^email|^e-mail/i){ @domain = split (',', $currow); shift @domain; $header = "undef"; } if($currow =~ m/[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\. +[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,3}))$/){ for my $i (0..$#domain){ my @currow = split (',', $currow); if ($currow[$i+1]) { $userhash{$currow[0]}{$domain[$i]} = 1; } else{ $userhash{$currow[0]}{$domain[$i]} = "undef"; } push (@emailList, $currow[0]); } } else{ print STDERR "This email address isn't properly formatted! $!\ +n" } }

In reply to Fix-it fix-it fix-it! by squimby

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • 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, 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, 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others taking refuge in the Monastery: (7)
    As of 2015-07-30 02:24 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (269 votes), past polls