Extract values from Perl variable

Hi Guys,

I am stuck in a problem.

I have a variable in Perl script which has value for example

X=a-b-c;

Now, I want to extract a b c separately into different 3 variables. I know this can be done in shell using awk but Perl behaves a bit different.

Can anybody help me on this please?

Thanks in advance,
Prashant

That example does not appear to be valid perl. What are you trying to do?

If you posted some the actual code, and explained what you wanted you would get better help.

Well, actually I want to extract values from variable.
If we use shell script

X=a-b-c
Var_a=`echo $X|awk -F"-" '{print $1}'`
Var_b=`echo $X|awk -F"-" '{print $2}'`

So, I want to get the same variable Var_a, Var_b in Perl.

Is it clear now?

#! /usr/bin/perl -w
use strict;

my $X = "a-b-c";
my @X = split /-/, $X;

foreach (@X) { print "$_\n" }