Re: parsing multiple logins logs (create a unique hash name for every user)

2012-09-11 Thread Brandon McCaig
On Mon, Sep 10, 2012 at 02:45:20PM -0500, Andy Bach wrote:
> On Mon, Sep 10, 2012 at 7:12 AM, Danny Gratzer  
> wrote:
> > while (){
> > my ($logindate, $dbserver, $hostname, $status ) = split (/,/);
> > $info{$username} = {$logindate=>[$dbserver, $hostname, $status]};
> > }
> 
> One thing to watch for - logins on the same day will overwrite
> here ...

Actually logins on any date for the same user will overwrite
since you're assigning a hash reference to the hash element each
time. I don't think grouping by login date was a requirement so a
structure more like this might make better sense:

$VAR1 = {
$username => [
{
'Login Date' => $logindate,
'DBServer' => $dbserver,
'Hostname' => $hostname,
'Login Status' => $status
},
{ ... },
{ ... },
{ ... },
]
};

Then you could iterate over it like so:

my @fields = (
'Login Date',
'DBServer',
'Hostname',
'Login Status',
);

for my $user (sort keys %info) {
print "$user\n";
print join("\t", @fields), "\n";

my $logins = $info{$user};

for my $login (@$logins) {
print join("\t", @{$login}{@fields}), "\n";
}

print "\n\n";
}

You'll want to read the standard perldocs to learn about data
types, slices, loops, etc. See `perldoc perl' for a list of core
perldocs that you may be interested in and begin reading. It's
really very important that you read through the core documents
when you begin. Until you do you won't be able to think of
solutions yourself.

Note that there are various ways to make the output more precise,
etc., depending on who or what will be reading it, etc. This is
just an example. You can RTFM to figure out how to make it
better. :) `perldoc -f sprintf' might be a good choice.

Regards,


-- 
Brandon McCaig  
Castopulence Software 
Blog 
perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }.
q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.};
tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say'



signature.asc
Description: Digital signature


Recommendations for emacs customizations for editing Perl

2012-09-11 Thread Vic Sage
I'd like to hear some recommendations from this list for customizations to emacs for coding Perl.One seemingly respected site, http://emacswiki.org/emacs/PerlLanguage, has a lot of links but unfortunately some are pretty dated.  For example, the Perl Develop Environment, http://search.cpan.org/dist/Emacs-PDE/, last updated in 2008, wouldn't install because my version of Perl (5.16.1) was "too far out of date."  So of course the question is, how up-to-date is emacswiki.org?As I say, I'm running Perl 5.16.1, and emacs 24.something.  I do have cperl-mode.el, but there are also a lot of goodies out there like variable-name completion and templates that look very useful.  I mostly don't want to be installing and troubleshooting stuff that hasn't been updated in five years and/or isn't "generally regarded" to be top quality.Thanks for any pointers or even advice about what to avoid :)Vic

Re: Recommendations for emacs customizations for editing Perl

2012-09-11 Thread John SJ Anderson
On Tuesday, September 11, 2012 at 9:08 PM, Vic Sage wrote:
> I'd like to hear some recommendations from this list for customizations to 
> emacs for coding Perl.
>  
> One seemingly respected site, http://emacswiki.org/emacs/PerlLanguage, has a 
> lot of links but unfortunately some are pretty dated.  For example, the Perl 
> Develop Environment, http://search.cpan.org/dist/Emacs-PDE/, last updated in 
> 2008, wouldn't install because my version of Perl (5.16.1) was "too far out 
> of date."  So of course the question is, how up-to-date is emacswiki.org 
> (http://emacswiki.org)?
>  
> As I say, I'm running Perl 5.16.1, and emacs 24.something.  I do have 
> cperl-mode.el, but there are also a lot of goodies out there like 
> variable-name completion and templates that look very useful.  I mostly don't 
> want to be installing and troubleshooting stuff that hasn't been updated in 
> five years and/or isn't "generally regarded" to be top quality.
>  
> Thanks for any pointers or even advice about what to avoid :)
>  
Well, there's the 'Tweakers Anonymous' talk I gave at YAPC…

* slides: http://www.slideshare.net/genehackdotorg/tweakers-anonymous-13313552
* video: http://www.youtube.com/watch?v=A3_lY-zlzik

There's also my Emacs config: https://github.com/genehack/emacs (the Perl stuff 
is mostly in etc/perl.el)

j.  



Re: Recommendations for emacs customizations for editing Perl

2012-09-11 Thread pangj

Have been coding perl with VIM always.

I'd like to hear some recommendations from this list for 
customizations to emacs for coding Perl.


One seemingly respected site, http://emacswiki.org/emacs/PerlLanguage, 
has a lot of links but unfortunately some are pretty dated.  For 
example, the Perl Develop 
Environment, http://search.cpan.org/dist/Emacs-PDE/, last updated in 
2008, wouldn't install because my version of Perl (5.16.1) was "too 
far out of date."  So of course the question is, how up-to-date is 
emacswiki.org?




Re: Recommendations for emacs customizations for editing Perl

2012-09-11 Thread Vic Sage
On Sep 11, 2012, at 10:24 PM, John SJ Anderson  wrote:
> Well, there's the 'Tweakers Anonymous' talk I gave at YAPC…
> 
> * slides: http://www.slideshare.net/genehackdotorg/tweakers-anonymous-13313552
> * video: http://www.youtube.com/watch?v=A3_lY-zlzik

Okay - good points to keep in mind.

> 
> There's also my Emacs config: https://github.com/genehack/emacs (the Perl 
> stuff is mostly in etc/perl.el)

Okay, this looks good but I don't know how to install it.  I have a .emacs file 
and a .emacs.d directory in my home directory; you have an init.el file and 
bin, etc, and share directories.  Can you give me the idiot's guide?  :)

V
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Recommendations for emacs customizations for editing Perl

2012-09-11 Thread John SJ Anderson
> > 
> > There's also my Emacs config: https://github.com/genehack/emacs (the Perl 
> > stuff is mostly in etc/perl.el)
> 
> Okay, this looks good but I don't know how to install it. I have a .emacs 
> file and a .emacs.d directory in my home directory; you have an init.el file 
> and bin, etc, and share directories. Can you give me the idiot's guide? :)
> 
If you're using Emacs 24.x, your init file should be .emacs.d/init.el. You 
should be able to just copy and paste stuff from my config into there and 
restart Emacs. Some of the config is dependent on packages, which you can 
install from MELPA or ELPA.

We're sort of skating on the edge of on-topic for Perl beginners here, so if 
what I'm saying doesn't make sense, you may want to look for basic resources on 
Emacs customization and start there.

chrs,
john. 



Re: Recommendations for emacs customizations for editing Perl

2012-09-11 Thread Shlomi Fish
Hi pangj,

On Wed, 12 Sep 2012 12:28:54 +0800
pangj  wrote:

> Have been coding perl with VIM always.
> 

Good for you, but the original question was about Emacs and it is a legitimate
question. There are many other possible editors that can be recommended,
but they are out of the scope of this thread. See:

http://www.shlomifish.org/philosophy/computers/web/use-qmail-instead/

Regards,

Shlomi Fish (who uses gvim and Vim for most coding too).

> > I'd like to hear some recommendations from this list for 
> > customizations to emacs for coding Perl.
> >
> > One seemingly respected site,
> > http://emacswiki.org/emacs/PerlLanguage, has a lot of links but
> > unfortunately some are pretty dated.  For example, the Perl Develop 
> > Environment, http://search.cpan.org/dist/Emacs-PDE/, last updated
> > in 2008, wouldn't install because my version of Perl (5.16.1) was
> > "too far out of date."  So of course the question is, how
> > up-to-date is emacswiki.org?
> 



-- 
-
Shlomi Fish   http://www.shlomifish.org/
"The Human Hacking Field Guide" - http://shlom.in/hhfg

 I find it’s usually safe to assume that whatever shlomif’s doing, there
isn’t a good reason for it.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/