Help for this page

Select Code to Download


  1. or download this
    my $equation = '979x + 87y - 8723z = 274320';
    my $vars = 'xyz'; 
    my $operators = qr/[-+*\/%=]/;
    my @parts = $equation =~ /([^\s$vars]+|[$vars]|$operators)/g;
    
  2. or download this
    perl -d
      DB<1> $equation = '979x + 87y - 8723z = 274320'
    ...
    7  'z'
    8  '='
    9  274320
    
  3. or download this
    my @parts = $equation =~ /([^xyz]+(?=[xyz])|[xyz])/g;
    
  4. or download this
    perl -d
    DB<1> $_='979x + 87y - 8723z = 274320'
    ...
    3  'y'
    4  ' - 8723'
    5  'z'