#!/usr/bin/perl $foo="data1.txt"; (my $first, my $second)=split(".",$foo); printf("Using a double quoted . the answer is first $first, second $second\n"); (my $first, my $second)=split("\.",$foo); printf("Using an escaped . the answer is first $first, second $second\n"); (my $first, my $second)=split("\\.",$foo); printf("Using a double quoted, double escaped . the answer is first $first, second $second\n"); (my $first, my $second)=split('.',$foo); printf("Using a single quoted . the answer is first $first, second $second\n"); (my $first, my $second)=split('\.',$foo); printf("Using a single quote escaped . the answer is first $first, second $second\n"); (my $first, my $second)=split('\\.',$foo); printf("Using a single quote double escaped . the answer is first $first, second $second\n"); (my $first, my $second)=split /./, $foo; printf("Using /./ in split the answer is first $first, second $second\n"); (my $first, my $second)=split /\./, $foo; printf("Using /\\./ in split the answer is first $first, second $second\n"); (my $first, my $second)=split /\\./, $foo; printf("Using /\\\\./ in split the answer is first $first, second $second\n"); #### Using a double quoted . the answer is first , second Using an escaped . the answer is first , second Using a double quoted, double escaped . the answer is first data1, second txt Using a single quoted . the answer is first , second Using a single quote escaped . the answer is first data1, second txt Using a single quote double escaped . the answer is first data1, second txt Using /./ in split the answer is first , second Using /\./ in split the answer is first data1, second txt Using /\\./ in split the answer is first data1.txt, second