Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 367
  • Last Modified:

Split

$var = "Firstname:Lastname";

I want to split $var on ":". I know how to do that. But what I want to know is that there any way to get the Lastname directly.

I don't mean something like this ($first,$last) = split(/:/,$var);

I mean to say something like split(/:/,$var)[1] .....is this possible to get last name directly.....in this manner.

Ash
0
ashish_wale
Asked:
ashish_wale
1 Solution
 
gripeCommented:
$lastname = (split(/:/, $var))[1];
0
 
ashish_waleAuthor Commented:
Thanks gripe....I was missing the outer brackets....thanks dude
0
 
manav_mathurCommented:
Did you understand why the outer bracket is necessary??

Manav

0
 
ozoCommented:
(and the inner bracket is unnecesary)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now