This was discussed recently, but here is one way that doesn't involve split at all.
Cheers - L~R#!/usr/bin/perl -w use strict; my $string = 'part of string to keep|part of string to toss'; my $keep = substr($string , 0 , index($string , '|'));
In reply to Re: using split without $junk
by Limbic~Region
in thread using split without $junk
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |