K
king
I have the below text:
Want to store it in array using regular expression.
The script is as below.
"
open(SYSCMD, "dccmd -listmodes |");
while(<SYSCMD>)
{
if(/^(\d+)[\s+](\d+)/)
{
chomp;
push(@X_Cord, $1);
}
if(/[\s+](\d+)[\s+](.*)$/)
{
chomp;
push(@Y_Cord, $1);
}
if(/(\d+)(\s+)(\d+)$/)
{
chomp;
push(@depth, $1);
}
if(/(\s+)(\d+)$/)
{
chomp;
push(@refresh, $1);
}
}
close(SYSCMD);
foreach(@X_Cord)
{
print "$_\n";
}
foreach(@Y_Cord)
{
print "$_\n";
}
foreach(@depth)
{
print "$_\n";
}
foreach(@refresh)
{
print "$_\n";
}
"
The output of dccmd command is
"Resolution Changer 3.12 from 12noon (12noon.com)
Width Height Depth Rate
320 200 8 60
320 200 16 60
320 200 32 60
512 384 8 60
512 384 16 60
512 384 32 60
640 400 8 60
640 400 16 60
640 400 32 60
640 480 8 60
640 480 16 60
640 480 32 60
800 600 8 60
800 600 16 60
800 600 32 60
1024 768 8 60
1024 768 16 60
1024 768 32 60
1280 800 8 60
1280 800 16 60
1280 800 32 60
"
From the script I am getting only X_cord and Y_cord. But I am not
getting the depth and refresh.
Can anybody help me with the refresh rate.
Want to store it in array using regular expression.
The script is as below.
"
open(SYSCMD, "dccmd -listmodes |");
while(<SYSCMD>)
{
if(/^(\d+)[\s+](\d+)/)
{
chomp;
push(@X_Cord, $1);
}
if(/[\s+](\d+)[\s+](.*)$/)
{
chomp;
push(@Y_Cord, $1);
}
if(/(\d+)(\s+)(\d+)$/)
{
chomp;
push(@depth, $1);
}
if(/(\s+)(\d+)$/)
{
chomp;
push(@refresh, $1);
}
}
close(SYSCMD);
foreach(@X_Cord)
{
print "$_\n";
}
foreach(@Y_Cord)
{
print "$_\n";
}
foreach(@depth)
{
print "$_\n";
}
foreach(@refresh)
{
print "$_\n";
}
"
The output of dccmd command is
"Resolution Changer 3.12 from 12noon (12noon.com)
Width Height Depth Rate
320 200 8 60
320 200 16 60
320 200 32 60
512 384 8 60
512 384 16 60
512 384 32 60
640 400 8 60
640 400 16 60
640 400 32 60
640 480 8 60
640 480 16 60
640 480 32 60
800 600 8 60
800 600 16 60
800 600 32 60
1024 768 8 60
1024 768 16 60
1024 768 32 60
1280 800 8 60
1280 800 16 60
1280 800 32 60
"
From the script I am getting only X_cord and Y_cord. But I am not
getting the depth and refresh.
Can anybody help me with the refresh rate.