Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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

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!
  • 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, 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?

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

    How do I use this? | Other CB clients
    Other Users?
    Others taking refuge in the Monastery: (4)
    As of 2018-12-12 05:31 GMT
    Find Nodes?
      Voting Booth?
      How many stories does it take before you've heard them all?

      Results (57 votes). Check out past polls.

      • (Sep 10, 2018 at 22:53 UTC) Welcome new users!