Hi Swetha.
This does what you want.
$input = "
geometry: 32x32
depth: 8
filesize: 1061b
interlace: None
background-color: gray74
border-color: gray74
matte-color: gray74
compression: JPEG
runlength packets: 945 of 1024
tainted: False
signature: xxxxazxxzwaswww
";
$input =~ s/^\s+//;
@fields = split /[\n:]+/, $input;
foreach (@fields)
{
s/^\s+//;
s/\s+$//;
}
%fields = @fields;
printf "%s = %s\n", $_, $fields{$_} foreach (sort keys %fields);
Output
background-color = gray74
border-color = gray74
compression = JPEG
depth = 8
filesize = 1061b
geometry = 32x32
interlace = None
matte-color = gray74
runlength packets = 945 of 1024
signature = xxxxazxxzwaswww
tainted = False
HTH,
Rob
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Srinivas
> Narahari
> Sent: 16 August 2001 06:31
> To: Toby Stuart
> Cc: [EMAIL PROTECTED]
> Subject: Re: How to get values ????
>
>
> Yep I used tilde.
>
> Some thing better. I got the big out put the variable. How to parse this
> variable. If I declare as an array or is there any other better way.
>
> please help me.
>
>
>
> I appreciate your help.
>
>
>
>
>
> swetha.
>
> ----- Original Message -----
> From: "Toby Stuart" <[EMAIL PROTECTED]>
> To: "'Swetha Jain'" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Wednesday, August 15, 2001 10:19 PM
> Subject: RE: How to get values ????
>
>
> > yes u doing wrong.
> >
> > try using the backticks...ie (SHIFT+tilde) ... on my 101 keyboard anyway.
> >
> > $info = `jpginfo MS.JPG`;
> >
> > forget system() as this returns the programs exit code (in your case 0
> which
> > probably means no error) and u want the programs output.
> >
> > hth
> >
> > t0by
> >
> >
> >
> > > -----Original Message-----
> > > From: Swetha Jain [SMTP:[EMAIL PROTECTED]]
> > > Sent: Thursday, August 16, 2001 3:01 PM
> > > To: [EMAIL PROTECTED]
> > > Cc: [EMAIL PROTECTED]
> > > Subject: RE: How to get values ????
> > >
> > > Thank you for your help. I tried this way
> > >
> > > my $info = system('jpgnfo MS.JPG');
> > >
> > > print qq| the values are $info|;
> > >
> > >
> > >
> > > I got 0 to $info variable. Am I doing some thing wrong ???
> > >
> > >
> > >
> > > Thanks,
> > >
> > > Swetha.
> > >
> > >
> > >
> > >
> > >
> > > >From: Toby Stuart
> > > >To: "'Swetha Jain'"
> > > >CC: "'[EMAIL PROTECTED]'"
> > > >Subject: RE: How to get values ????
> > > >Date: Thu, 16 Aug 2001 14:45:06 +1000
> > > >
> > > >u could try:
> > > >
> > > > $info = `jpginfo MS.JPG`;
> > > >
> > > >and see if $info contains anything useful.
> > > >
> > > >hth
> > > >
> > > >t0by
> > > >
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Swetha Jain [SMTP:[EMAIL PROTECTED]]
> > > > > Sent: Thursday, August 16, 2001 2:45 PM
> > > > > To: [EMAIL PROTECTED]
> > > > > Subject: How to get values ????
> > > > >
> > > > > Hi all,> > "urn:schemas-microsoft-com:office:office" />
> > > > >
> > > > > I have one program (executable) which returns some values when I
> > > execute
> > > > > from the Unix prompt. How can I get those values into a perl
> variable.
> > >
> > > > >
> > > > > Here is the example.
> > > > >
> > > > >
> > > > >
> > > > > system(' jpginfo MS.JPG') it returns some properties of image like
> > > > > these
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > geometry: 32x32
> > > > > depth: 8
> > > > > filesize: 1061b
> > > > > interlace: None
> > > > > background-color: gray74
> > > > > border-color: gray74
> > > > > matte-color: gray74
> > > > > compression: JPEG
> > > > > runlength packets: 945 of 1024
> > > > > tainted: False
> > > > > signature: xxxxazxxzwaswww
> > > > >
> > > > >
> > > > >
> > > > > How can I capture these values to perl variable?
> > > > >
> > > > >
> > > > >
> > > > > I appreciate any ones help.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Swetha Jain.
> > > > >
> > > > >
> > > > > _____
> > > > >
> > > > > Get your FREE download of MSN Explorer at http://explorer.msn.com
> > > > >
> > > > >
> > > > > _______________________________________________ ActivePerl mailing
> > > list
> > > > > [EMAIL PROTECTED]
> > > > > http://listserv.ActiveState.com/mailman/listinfo/activeperl
> > > >_______________________________________________
> > > >ActivePerl mailing list
> > > >[EMAIL PROTECTED]
> > > >http://listserv.ActiveState.com/mailman/listinfo/activeperl
> > >
> > > _____
> > >
> > > Get your FREE download of MSN Explorer at http://explorer.msn.com
> > > <http://go.msn.com/bql/hmtag_itl_EN.asp>
> > >
> > > _______________________________________________ ActivePerl mailing list
> > > [EMAIL PROTECTED]
> > > http://listserv.ActiveState.com/mailman/listinfo/activeperl
> > _______________________________________________
> > ActivePerl mailing list
> > [EMAIL PROTECTED]
> > http://listserv.ActiveState.com/mailman/listinfo/activeperl
> >
> _______________________________________________
> ActivePerl mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/activeperl
>
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl