Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Splitting a long row with multiple delimiters.

by jahero (Pilgrim)
on Jan 19, 2018 at 13:54 UTC ( [id://1207522]=note: print w/replies, xml ) Need Help??


in reply to Splitting a long row with multiple delimiters.

Update: actually,this does not work. The reregex in question might be visually pleasing, but is plain wrong. Shame on me...

Second possible approach. Be advised, one = sign out of place, and it does not work anymore.

use feature qw/say/; use strict; use warnings; use Data::Dumper; while (my $line=<DATA>) { chomp $line; my %record = ($line =~ /([^=]+)=([^=]+) ?/g); say Dumper \%record; } __DATA__ eab12345 id=00000 pgrp=abcdefgh groups=abcdefgh home=/home/eab12345 sh +ell=/usr/bin/ksh gecos=AB/C/Y0000/ABC/XYZ RTYUI, LMNOP *CONTRACTOR* ( +AS 00000) auditclasses=general,files,TCPIP login=true su=true rlogin= +true daemon=true admin=false sugroups=ALL admgroups= tpath=nosak ttys +=ALL expires=0 auth1=SYSTEM auth2=NONE umask=00 registry=AD SYSTEM=AD + logintimes= loginretries=5 pwdwarntime=5 account_locked=false minage +=0 maxage=13 maxexpired=0 minalpha=1 minother=1 mindiff=1 maxrepeats= +2 minlen=8 histexpire=13 histsize=8 pwdchecks= dictionlist=/abc/def/g +hi/jkl default_roles= fsize=-1 cpu=-1 data=-1 stack=65536 core=000000 + rss=65536 nofiles=2000 time_last_login=1512632113 time_last_unsucces +sful_login=1505304923 tty_last_login=ssh tty_last_unsuccessful_login= +ssh host_last_login=0.000.000.000 host_last_unsuccessful_login=0.000. +000.000 unsuccessful_login_count=0 roles=

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-03-29 14:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found