in reply to Split line with corresponding columns and values

#!/usr/bin/perl use strict; my $data = '\player_0\STOMP\frags_0\0\ping_0\ 146\team_0\0\mesh_0\Male + Soldier\skin_0\TOPModels.Skins.CCSM\face_0\TOPModels.Skins.Legs\ngse +cret_0\false\player_1\animals\frags_1\0\ping_1\ 374\team_1\1\mesh_1\M +ale Soldier\skin_1\TOPModels.Skins.SFMe\face_1\TOPModels.Skins.SWATTe +x0\ngsecret_1\false\player_2\Rigodon\frags_2\0\ping_2\ 159\team_2\1\m +esh_2\Male Soldier\skin_2\TOPModels.Skins.SFMe\face_2\TOPModels.Skins +.SWATTex0\ngsecret_2\false\queryid\64.1'; my %hash = split(/\\/, $data); foreach (keys %hash) { print "$_ = $hash{$_}\n"; } exit;

Replies are listed 'Best First'.
Re: Re: Split line with corresponding columns and values
by gloryhack (Deacon) on Nov 11, 2001 at 01:15 UTC
    Oops... with that leading bugslash on there, you'll want to do this after the assignment of $data:
    $data =~ s/^\\//;
Re: Re: Split line with corresponding columns and values
by foogod (Friar) on Nov 11, 2001 at 01:22 UTC

    Thanks alot guys!

    For whatever reason I completely forgot about the key value ... its been a long month! :-)

    This is working great ... I am also checking into Data::Dumper ... but for now this is great.

    Thanks for the fast (very fast!) replies.

    - f o o g o d