perl数据处理,包括$/的使用,在此请教大家

perl数据处理,包括$/的使用,在此请教大家

一文本文件,是ldap的ldif文件,文件格式如下:

dn: loginName=user1, l=Hang, o=test.com
owVLanId: 15
category: Residential
owPop: 1415
userPassword: {CRYPT}kvVeeh/BwWRdE
owRoamState: 1
status: Active
loginName: user1
objectclass: top
objectclass: customer
cn: user1157
creatorsname: cn=Manager
modifiersname: cn=Manager
createtimestamp: 20060724101721Z
modifytimestamp: 20060724101721Z

dn: serviceCode=Internet, loginName=user1, l=Hang zhou, o=test.com
endDate: 200712082359Z
serviceCode: Internet
status: Active
npSessionsAllowed: 1
startDate: 200605082359Z
profile: 1024kInternet
objectclass: top
objectclass: subscription
subPeriodKey: 0
creatorsname: cn=Manager
modifiersname: cn=Manager
createtimestamp: 20060724101721Z
modifytimestamp: 20060724101721Z

.....

每个段落都以一空白行分割.
现在要得到如下格式:
loginName status modifytimestamp
以上3个是对应值.
请各位指教!!!谢谢.

1. Basicway:
Read ldif file in paragraph (empty line seperatly) .
Using HoH (referece hash of ref. hash) to store the paragraph data,
Using dn as your main key and split ":" to put attribute's name/value in ref. hash,
such as:

QUOTE:
$ref_hash = {
    'loginName=user1, l=Hang, o=test.com' =>
        { 'owVLanId' => '15',
          'category' => 'Residential'
          # ... more attributes name/value ....
        },

    # further recordes... ,
}

2. CPAN module: Net::LDAP::LDIF for standard LDIF data processing.
谢谢!
我看看module试试看.
谢谢!